The Schema collections return metadata for the Teradata Database objects. The notable metadata columns for the Double data type are:
Column Name | Description |
---|---|
COLUMN_TYPE or DATA_TYPE |
Set to DOUBLE PRECISION. |
NUMERIC_PRECISION | Set to 15. |
FORMAT | Teradata Database Format assigned to the Teradata Database object. |
PROVIDERDBTYPE | It is set to TdType.Double. |
The TdDataReader.GetSchemaTable returns result set metadata. The notable metadata columns for the Double data type are:
Column Name | Description | ||
---|---|---|---|
NumericPrecision | Set to 15. | ||
DataType | System.Type object for the System.Double type. | ||
ProviderType | Set to TdType.Double. | ||
Format | Teradata Database Format assigned to the Teradata Database object. | ||
ProviderSpecificDataType |
System.Type object for the System.Double structure.
|
The following example shows how to configure a Double parameter using DbType type declaration and a BCL value.
C# |
Copy Code
|
---|---|
TdParameter quantity = new TdParameter();
quantity.DbType = DbType.Double;
quantity.Value = 1.2349;
|
The following example shows how to configure a Double parameter using TdType type declaration and a BCL value.
C# |
Copy Code
|
---|---|
TdParameter quantity= new TdParameter();
quantity.TdType = TdType.Double;
quantity.Value = Double.Epsilon;
|
![]() |
---|
The Teradata Database DOUBLE PRECISION data type officially supports ±2.226 x 10-308 to ±1.797 x 10308 range of values. |
The syntax for the Double Precision Literal is ±n.nE±m. Double literal consist of an optional sign, up to 15 digits representing the whole and fractional components of the mantissa, literal character E, optional sign and finally up to 3 digits representing the exponent.
![]() |
---|
We recommend to always use Parameters in order to take advantage of the Teradata Database Request Cache. |
The following example shows 12,987,561 represented as Double 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 > 1.2987561E7 "; using (TdDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { Console.WriteLine("Id={0}, orderDate={1}", reader.GetInt64(0), reader.GetDate(1)); } } } } |
The following methods and properties return the column or parameter value as a System.Double structure.
The following Provider Specific Value method and property return the column or parameter value as a System.Double structure.
![]() |
---|
The Data Provider does not have a Provider Specific Type corresponding to the Double Precision data type. The Data Provider returns System.Double data type from the Provider Specific Value methods. |
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.Double); cmd.Parameters["quantity"].Value = 1.2987561E+7; using (TdDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { Console.WriteLine("[System.Double] Quantity = {0}", reader.GetDouble(1).ToString()); } } } } /* Output: [System.Double] Quantity = 1.3E+7; */ |
Accessor Methods for Retrieving Data
Configuring Parameters and Parameter Data Types