TABLEID - Advanced SQL Engine - Teradata Database

Database Utilities

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
xha1591998860283.ditamap
dita:ditavalPath
xha1591998860283.ditaval
dita:id
B035-1102
lifecycle
previous
Product Category
Teradata Vantage™

The TABLEID command displays the table number of the specified table when given the database name and table name.

Syntax

TABLEID {
  "databasename.tablename" |
  "databasename"."tablename" |
  'databasename.tablename' |
  'databasename'.'tablename'
}

Syntax Elements

databasename
The name of the database containing the table for which the table number will be displayed.
tablename
The name of the table for which the table number will be displayed.
The database name and table name must be delimited by apostrophes or double quotation marks, as indicated in the syntax diagram.

Usage Notes

A table is identified in the Data Dictionary by a table number (tvm.tvmid). Each table number is unique across the whole system, rather than local to a database. Therefore, a table number uniquely identifies a table in the system.

The TABLEID command displays the table number of the table specified by databasename and tablename. The output of the TABLEID command is a numeric subtable identifier (tid), which consists of three numbers:
  • The first two comprise the table number. This pair of numbers is used to uniquely identify a table in the system.
  • The third is the typeandindex value, which specifies a kind of subtable, such as a table header, data subtable, or a particular index subtable. TABLEID always returns a typeandindex value of zero (0), which specifies the table header.

For more information on how to interpret a tid, see Using Ferret Parameters.

The following rules apply when specifying databasename and tablename:
  • The period (.) is required to separate the database name from the table name.
  • You must use either apostrophes ( ' ) or double quotation marks ( " ) when typing a database name and table name. The results are the same.
  • You can specify a fully qualified table name using any one of the methods suggested in the syntax diagram with the following exceptions:
    • The object name itself includes an apostrophe, in which case you must enclose the object name within double quotation marks.
      Valid examples include the following:
      • tableid "xyz.mark’s table"
      • tableid "xyz"."mark’s table"
      Invalid examples include the following:
      • tableid 'xyz.mark’s table'
      • tableid "xyz".'mark’s table'
    • The object name has a period, in which case you must type the fully qualifying tablename in the form of "database"."tablename" or 'database'.'tablename'.
      Valid examples include the following:
      • tableid "xyz.0’s"."mark’s table.2.53.00"
      • tableid 'xyz'.'table.0'
      Invalid examples include the following:
      • tableid "xyz.0’s.mark’s table.2.53.00"
      • tableid 'xyz.0’s.mark’s table.2.53.00'

Example: Using TABLEID to display the table ID number

The following example shows output generated by TABLEID:

Ferret ==> tableid "mydatabase.mytable"
 The table id for MYDATABASE.MYTABLE is
 1 1217 0  (0x0001 0x4C1 0x0000)
You could get the same results with the following commands:
tableid 'mydatabase.mytable'
tableid "mydatabase"."mytable"
tableid 'mydatabase'.'mytable'