Send feedback on this topic.
Teradata.Client.Provider
GetSchemaTable Method



Teradata.Client.Provider Namespace > TdDataReader Class : GetSchemaTable Method
Returns a DataTable that has one row (DataRow) for each column. The rows describe the column metadata.
Syntax
'Declaration
 
Public Overrides NotOverridable Function GetSchemaTable() As DataTable
'Usage
 
Dim instance As TdDataReader
Dim value As DataTable
 
value = instance.GetSchemaTable()
public override DataTable GetSchemaTable()
public:
DataTable^ GetSchemaTable(); override 

Return Value

It returns a DataTable for data returning statements (SQL). The DataTable has one row of metadata for each column. It returns null when there is no column metadata.
Exceptions
ExceptionDescription
The TdDataReader is closed.
Remarks

The GetSchemaTable returns the following metadata about each column in the TdDataReader:

Column Name Type and Description

ColumnName

Type: String

The name of the column which may not be unique. The title of the column is returned if the name is null.

ColumnOrdinal

Type: Int32

The ordinal (index of array) of the column. Columns are numbered starting from zero.

ColumnSize

Type: Int32

The maximum possible length of the column in bytes or characters.

  • Numeric Data Types: This is the size of the data type in bytes (for example, 4 for INTEGER).

  • Character and CLOB Data Types: The maximum length of the column in characters for LATIN, UNICODE and GRAPHIC. The maximum length of the column in bytes (single-byte character) for KANJI1 and KANJISJIS.

  • Byte and BLOB Data Types: The maximum length of the column in bytes.

  • DateTime and Interval Data Types: The maximum length of the column in characters.

  • JSON Data Type: The maximum length of the column in characters.

NumericPrecision

Type: Int16

  • NUMERIC Data Types: This is the maximum precision of the column. The range of precision for DECIMAL Data type is from 1 to 38 and it depends on the column definition (for example, Decimal(13,2)).

  • DateTime Data Types: This is the maximum length in characters.

  • Interval Data Types: This is the number of digits in the most significant field of the interval. For example a TdIntervalDayToHour value of '400 10' would contain a NumericPrecision of 3.

  • All other Data Types: This field is set to 255.

NumericScale

Type: Int16

  • Decimal Data Types: This is the maximum number of digits to the right of the decimal point.

  • Time, Time With Time Zone, Timestamp and Timestamp With Time Zone Data Types: This is the maximum number of digits to the right of the decimal point.

  • Interval Data Types: This is the maximum number of digits to the right of the decimal point for all intervals that contain seconds - TdIntervalDayToSecond, TdIntervalHourToSecond, TdIntervalMinuteToSecond and TdIntervalSecond.

  • All other Data Types: This field is set to 255.

DataType

Type: Type

The .NET Framework data type of the column.

ProviderType

Type: Int32

Teradata data type of the column. See TdType Enumeration.

IsLong

Type: Boolean

  • CLOB, BLOB, XML and JSON Data Types: This column is set to true.
  • All other Data Types: This column is set to false.

AllowDBNull

Type: Boolean

Set to true if column does not have a ‘NOT NULL’ attribute. See the SQL Reference – Data Types and Literals manual.

IsReadOnly

Type: Boolean

  • the Teradata Database 6.1 or earlier: This column is always set to false.

  • Teradata Database 6.2 or higher and TdConnectionStringBuilder.UseEnhancedSchemaTable option is set to true: This DataTable column is set to true if any of the following conditions are true:

    1. Teradata column is defined as "GENERATED ALWAYS AS IDENTITY".
    2. Teradata column is the result of an expression.
    3. User does not have UPDATE privilege/permission to the column.

IsRowVersion

Type: Boolean

This column is always set to false.

IsUnique

Type: Boolean

  • Teradata Database 6.1 or earlier: This column is always set to false.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This DataTable column is set to true if any of the following conditions are true for the base table (BaseTableName):

    1. The Teradata column represents a Primary Key by itself.

    2. The Teradata column is the one and only column of a Unique Constraint.

    3. The Teradata column is the one and only column of a Unique Index.

IsKey

Type: Boolean

  • Teradata Database 6.1 or earlier: This column is always set to false.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true:

    • true: The column is one of a set of columns (one or more) in the DataReader that, taken together, uniquely identify the row in the base-table (see BaseTableName).

    • false: The column is not part of a Key.

    Note: IsKey and IsUnique columns are set to true for a Primary Key with one column.

IsAutoIncrement

Type: Boolean

  • Teradata Database 6.1 or earlier: This column is always set to false.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to true if the column is declared as a "GENERATED ALWAYS" Identity column; otherwise it is set to false.

BaseSchemaName

Type: String

  • Teradata Database 6.1 or earlier: This column is always set to null.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to the name of the Database that contains the base table. It is set to null if the Database name cannot be determined.

BaseCatalogName

Type: String

This column is always set to null.

BaseTableName

Type: String

  • Teradata Database 6.1 or earlier: This column is always set to null.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to the name of the Table or View that contains the base column. It is set to null if the Table or View name cannot be determined.

BaseColumnName

Type: String

  • Teradata Database 6.1 or earlier: This column is always set to null.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to the name of the Column in the SQL Engine. It will not match the ColumnName when an Alias (AS) is used. It is set to null if the Column name cannot be determined.

Title

Type: String

Teradata TITLE defines a heading for the column that can be different from the column name. For additional information refer to Data Types and Literals SQL Reference manual for Teradata.

Format

Type: String

Teradata FORMAT controls the display of expressions and column data. It has no affect on Numeric, DateTime and Interval columns retrieved through methods like GetInt32, GetDecimal, GetDate. However CHAR and VARCHAR columns are affected by the FORMAT; as Teradata Database applies the FORMAT to the data before it is send to the .NET Data Provider for Teradata. For additional information refer to Data Types and Literals SQL Reference manual for Teradata.

ProviderSpecificDataType

Type: System.Type

.NET Data Provider for Teradata Provider Specific Type. Refer to TdDataReader.GetProviderSpecificFieldType for additional information.

IsAliased

Type: Boolean

  • Teradata Database 6.1 or earlier: This column is always set to false.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to true if the ColumnName is an alias; otherwise it is set to false.

IsExpression

Type: Boolean

  • Teradata Database 6.1 or earlier: This column is always set to false.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to true if the column is a result of an expression; otherwise it is set to false.

IsIdentity

Type: Boolean

  • Teradata Database 6.1 or earlier: This column is always set to false.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to true if the column is an Identity column; otherwise it is set to false.

TemporalType

Type: Byte

  • Teradata Database 13.0 or earlier: This column is always set to 255.

  • Teradata Database 13.10 or higher and UseEnhancedSchemaTable option is set to true:

    • 0: The column is a non-temporal column.

    • 1: The column is a ValidTime temporal column.

    • 2: The column is a TransactionTime temporal column.

  • Teradata Database 13.10 or higher and UseEnhancedSchemaTable option is set to false: This column is always set to 255.

ColumnInfo

Type: String

Teradata Database 13.10 or earlier: This column is always set to null.

Teradata Database 14.0 or higher:

FIXED The NUMBER represents a fixed decimal point number.
FLOAT The NUMBER represents a floating decimal point number.
TEXT JSON storage format.
BSON JSON storage format.
UBJSON JSON storage format.

DefaultValue

Type: String

  • Teradata Database 6.1 or earlier: This column is always set to null.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to the default value assigned to the Column in Teradata Database. It is set to null if the column does not have a default value associated with it.

UDTName

Type: String

  • Teradata Database 6.1 or earlier: This column is always set to null.

  • Teradata Database 6.2 or higher and UseEnhancedSchemaTable option is set to true: This field is set to the fully qualified UDT name if the column is a user defined type. It is set to null if the column is not a user defined type.

UDTType

Type: Byte

Specifies the Type of the User-Defined-Type:
1 Structured
2 Distinct
3 Internal
DBNull Undefined or Not a User-Defined-Type column.

CharacterSet

Type: Byte

Specifies the server character set for a character column:
1 Latin
2 Unicode
3 KanjiSJIS
4 Graphic
5 Kanji1
DBNull Undefined or not a Character column.

ServerDataType

Type: Int32

Teradata data type code.

This column is only populated for DATASET columns.

The data will be transmitted to/from the Teradata Database in the form described in ProviderType above.
This depends on the Transform that is in use by the session.

Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdDataReader Class
TdDataReader Members