Send feedback on this topic.
Teradata.Client.Provider
BigInt Data Type
.NET Data Provider for Teradata > Developer's Guide > Data Types > Numeric Data Types > BigInt Data Type

Schema Collections

The Schema collections return metadata for the Adanced SQL Engine objects. The notable metadata columns for the BigInt data type are:

Column Name Description

COLUMN_TYPE

or

DATA_TYPE

Set to BIGINT.
NUMERIC_PRECISION Set to 19.
FORMAT Format assigned to the SQL Engine object.
PROVIDERDBTYPE It is set to TdType.BigInt.

Schema Table

The TdDataReader.GetSchemaTable returns result set metadata. The notable metadata columns for the BigInt data type are:

Column Name Description
NumericPrecision Set to 19.
DataType System.Type object for the System.Int64 type.
ProviderType Set to TdType.BigInt.
Format Format assigned to the SQL Engine object.
ProviderSpecificDataType

System.Type object for the System.Int64 structure.

Note

The Data Provider does not have a Provider Specific Type corresponding to the BigInt data type. The Data Provider returns System.Int64 data type from the Provider Specific Value methods.

Configuring Parameters

The following example shows how to configure a BigInt parameter using DbType type declaration and a BCL value.

C#
Copy Code
TdParameter quantity = new TdParameter();

quantity.DbType = DbType.Int64;

quantity.Value = 33000;

The following example shows how to configure a BigInt parameter using TdType type declaration and a BCL value.

C#
Copy Code
TdParameter quantity= new TdParameter();

quantity.TdType = TdType.BigInt;

quantity.Value = 33000;

Specifying BigInt as Literal

The syntax for the BigInt Hexadecimal Integer Literal is 'hexadecimal digits'XI8. BigInt hexadecimal literal consist of 1 to 16 hexadecimal digits delimited by matching pair of apostrophes followed by XI8 modifiers.

Note

We recommend to always use Parameters in order to take advantage of the SQL Engine's Request Cache.

 

The following example shows 12,987,561 represented as BigInt Hexadecimal Literal in the Command Text.

C#
Copy Code
using (TdConnection cn = new TdConnection("data source=x;UserId=y;Password=z;"))
{
    cn.Open();
    TdCommand cmd = cn.CreateCommand();

    cmd.CommandText = "SELECT Id, orderDate from Order where quantity > 'C62CA9'XI8  ";

    using (TdDataReader reader = cmd.ExecuteReader())
    {
        if (reader.HasRows)
        {
            while (reader.Read())
            {
                Console.WriteLine("Id={0}, orderDate={1}", reader.GetInt64(0), reader.GetDate(1));
            }
        }
    }
}

Retrieving BigInt Data

The following methods and properties return the column or parameter value as a System.Int64 structure.

  1. TdDataReader.GetInt64
  2. TdDataReader.GetValue
  3. TdDataReader.GetFieldValue<Int64>
  4. TdParameter.Value
  5. TdParameter.GetValue<Int64>

The following Provider Specific Value method and property return the column or parameter value as a System.Int64 structure.

Note

The Data Provider does not have a Provider Specific Type corresponding to the BigInt data type. The Data Provider returns System.Int64 data type from the Provider Specific Value methods.

  1. TdDataReader.GetProviderSpecificValue
  2. TdParameter.ProviderSpecificValue

C#
Copy Code
using (TdConnection cn = new TdConnection("data source=DS1;UserId=Joe;Password=XY;"))
{
    cn.Open();

    TdCommand cmd = cn.CreateCommand();
    cmd.CommandText = "SELECT Id, Quantity from Order where Quantity > ?";
    cmd.Parameters.Add("quantity", TdType.BigInt);
    cmd.Parameters["quantity"].Value = 33000;

    using (TdDataReader reader = cmd.ExecuteReader())
    {
        if (reader.HasRows)
        {
            while (reader.Read())
            {
                Console.WriteLine("[System.Int64] Quantity = {0}", reader.GetInt64(1).ToString());
            }
        }
    }
}

/* Output:
    [System.Int64] Quantity = 33099
*/

See Also

Data Type Mappings

Accessor Methods for Retrieving Data

Configuring Parameters and Parameter Data Types