9 The SQL Server Data Provider : Data Types

Data Types
Table 9-2 through Table 9-5 list the data types supported by the SQL Server data provider.
Table 9-2 maps the SQL Server data types to the .NET Framework types.
Table 9-3 maps the data types the data provider uses if only the System.Data.DbType is specified.
Table 9-4 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.
Table 9-5 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
Table 9-2 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:
 
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:
Table 9-3 shows the mapping that is used if only the System.Data.DbType is specified.

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.

Table 9-4 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.
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 Table 9-5.
See “Using Streams as Input to Long Data Parameters” for more information about using streams.