Send feedback on this topic.
Teradata.Client.Provider
Generated Data Retrieval (Identity Column Support)
.NET Data Provider for Teradata > Developer's Guide > Working with the Data Provider Features > Generated Data Retrieval (Identity Column Support)

Identity columns may be generated automatically by the database, or they may be supplied by the client application depending upon the table creation options. Table cardinality is limited by the maximum value of the identity column numeric data type. The maximum numeric data type is decimal(18,0). Even though the .NET Data Provider for Teradata and the Teradata database support precision of 38 digits (V2R6.2), the maximum identity value supported by the database is limited by the data types decimal(18,0).

Generated data retrieval contains 3 options for retrieval of results from an insert or insert/select statement types:

  1. A table identity column value may be returned
  2. All column values
  3. The default behavior will return the result of the query and no identity column information.

These options may be selected from a new property created in TdCommand. The new property is GeneratedDataBehavior and the values are:

Teradata Database Support

Support for SQL Identity Columns was introduced in Teradata Database release V2R5.0. However, this release did not support retrieval of the identity column value during the retrieval of the result set of an insert statement. The application was required to issue an additional query to retrieve the results of the identity column value.

The .Net Provider for Teradata supports returning the identity column information or column information for the entire row starting with Teradata Database V2R6.2 and later releases.

Provider Supported Features

The SQL statement types supported by this feature are:

  1. Inserts
  2. Insert-Selects
  3. Multi-Statement Inserts

Any attempt to execute commands to return generated data from a Teradata Database release before V2R6.2 results in a TdException being thrown by the provider.

Generated data retrieval may also be utilized against Teradata tables that do not contain an identity column.  Column information is returned while specifying GeneratedDataBehavior of AllColumns.   The values of GeneratedDataBehavior include IdentityColumn, AllColumns and None.   None is the default setting, which disables this information retrieval.

The following are examples of accessing the generated data retrieval feature.

Feature Support Description
TdCommand Support Example A new TdCommand property to support this feature.
TdDataAdapter Support Example The TdDataAdapter may be used to generate commands without a TdCommandBuilder.
TdDataAdapter and TdCommandBuilder Support Example TdCommandBuilder is utilized to build commands for TdDataAdapter.
Non-Identity Column Table Support Example Returning Default Column Values.
Visual Studio 2005 Support Visual Studio 2005 Designer support (Teradata Generated Data Behavior Support).