Data Types
- Last Updated: April 16, 2026
- 4 minute read
- ADO.NET
- Documentation
The following table list the data types supported by the SQL Server data provider.
- Mapping SQL Server Data Types maps the SQL Server data types to the .NET Framework types.
- Mapping System.Data.DbTypes to SQLServerDbType Enumerations maps the data types the data provider uses if only the System.Data.DbType is specified.
- Mapping .NET Framework Data Types to SQLServerDbTypes maps the data types the data provider uses to infer a data type if the provider-specific type and the System.Data.DbType are not provided.
- Data Types Supported With Stream Objects maps the data types the data provider uses when streams are used as inputs to Long data parameters.
Mapping SQL Server Data Types to .NET Framework Data Types
The following table lists the data types supported by the SQL Server data provider and how they are mapped to the .NET Framework types. You can use the table to infer the data types that will be used when a DataSet is filled using a DataAdapter. This table also identifies the accessors to use for accessing the data when a DataReader object is used directly.
In this table, the columns are defined as follows:
- The SQL Server Data Type column refers to the native type name.
- The SQLServerDbType column refers to the SQL Server data provider’s type enumeration. Generally, there is a one-to-one mapping between the native type and the SQLServerDbType.
- The .NET Framework Type column refers to the base data types available in the Framework.
- The .NET Framework Typed Accessor column refers the method that must be used to access a column of this type when using a DataReader.
Mapping SQL Server Data Types
| SQL Server Data Type | SQLServerDbType | .NET Framework Type | .NET Framework Typed Accessor |
| bigint | BigInt | Int64 | GetInt64() |
| binary | Binary | Byte[] | GetBytes() |
| bit | Bit | Boolean | GetBoolean() |
| char | Char | String[] Char[] |
GetString() GetChars() |
| datetime | DateTime | DateTime | GetDateTime() |
| decimal | Decimal | Decimal | GetDecimal() |
| float | Float | Double | GetDouble() |
| image | Image | Byte[] | GetBytes() |
| int | Int | Int32 | GetInt32() |
| money | Money | Decimal | GetDecimal() |
| nchar | Nchar | String[] Char[] |
GetString() GetChars() |
| ntext | Ntext | String[] Char[] |
GetString() GetChars() |
| numeric | Decimal | Decimal | GetDecimal() |
| nvarchar | NVarChar | String[] Char[] |
GetString() GetChars() |
| nvarchar(max) | NVarChar | String[] Char[] |
GetString() GetChars() |
| real | Real | Single | GetSingle() |
| smalldatetime | SmallDateTime | DateTime | GetDateTime() |
| smallint | SmallInt | Int16 | GetInt16() |
| smallmoney | SmallMoney | Decimal | GetDecimal() |
| text | Text | String[] Char[] |
GetString() GetChars() |
| timestamp | Timestamp | Byte[] | GetByte() |
| tinyint | TinyInt | Byte | GetByte() |
| varbinary | VarBinary | Byte[] | GetBytes() |
| varbinary(max) | VarBinary | Byte[] | GetBytes() |
| varchar | VarChar | String[] Char[] |
GetString() GetChars() |
| varchar(max) | VarChar | String[] Char[] |
GetString() GetChars() |
| Xml | Xml | String | GetChars() GetString() GetValue() GetValues() GetXmlReader() |
Mapping Parameter Data Types
The type of the parameter is specific to each DataDirect Connect for ADO.NET data provider. The SQL Server data provider must convert the parameter value to a native format before sending it to the server. The best way for an application to describe a parameter is to use the provider-specific type enumeration. In generic programming circumstances, the provider-specific type may not be available. In this situation, the data type must be inferred from either the System.Data.DbType or from the .NET Framework type of the parameter’s value.
The SQL Server data provider uses the following order when inferring the data type of a parameter:
- The data provider uses the provider-specific data type if it has been specified.
- The data provider infers the data type from the System.Data.DbType if it has been specified, but the data provider-specific type has not been specified.
- The data provider infers the data type from the .NET Framework type if the provider-specific type and the System.Data.DbType have not been specified.
The following table shows the mapping that is used if only the System.Data.DbType is specified.
Mapping System.Data.DbTypes to SQLServerDbType Enumerations
| System.Data.DbType | SQLServerDbType Enumeration |
| AnsiString | VarChar |
| AnsiStringFixedLength | Char |
| Binary | VarBinary VarBinary(Max)1 |
| Boolean | Bit |
| Byte | TinyInt |
| Currency | Money |
| Date | DateTime |
| DateTime | DateTime |
| Decimal | Decimal |
| Double | Float |
| Int16 | SmallInt |
| Int32 | Int |
| Int64 | BigInt |
| Sbyte | SmallInt |
| Single | Real |
| String | NVarChar VarBinary NVarChar(Max)2 VarChar(Max)2 XML2 |
| StringFixedLength | NChar |
| Time | DateTime |
| Uint16 | Int |
| Uint32 | Decimal |
| Uint64 | Decimal |
| VarNumeric | Decimal |
1 On Microsoft SQL Server 2005, the data provider supports fetching columns of type VarBinary(Max) as a Blob.
2 On Microsoft SQL Server 2005, the data provider supports fetching columns of type NVarChar(Max), VarChar(Max), and XML as a Clob.
The following table shows the mapping that the data provider uses to infer a data type if the provider-specific type and the System.Data.DbType are not provided.
Mapping .NET Framework Data Types to SQLServerDbTypes
| .NET Framework Type | SQLServerDbType |
| Boolean | Bit |
| Byte | TinyInt |
| Byte[] | VarBinary |
| DateTime | DateTime |
| Decimal | Decimal |
| Double | Float |
| Int16 | SmallInt |
| Int32 | Int |
| Int64 | BigInt |
| Single | Real |
| String | NVarChar |
| Uint16 | Int |
| Uint32 | Decimal |
| Uint64 | Decimal |
Data Types Supported With Stream Objects
The SQL Server data provider supports the use of streams as inputs to Long data parameters with the data types listed in the following table.
Data Types Supported With Stream Objects
| SQL Server Data Type | Stream Type Supported |
| Image | Stream |
| Text | TextReader |
| NText | TextReader |
| Xml | TextReader |
See Using Streams as Input to Long Data Parameters for more information about using streams.