SQL Server Data Types and ADO.NET

SQL Server and the .NET Framework are based on different type systems, which can result in potential data loss. To preserve data integrity, the .NET Framework Data Provider for SQL Server (System.Data.SqlClient) provides typed accessor methods for working with SQL Server data. You can use the enumerations in the SqlDbType classes to specify SqlParameter data types.

For more information and a table that that describes the data type mappings between SQL Server and .NET Framework data types, see SQL Server Data Type Mappings.

SQL Server 2008 introduces new data types that are designed to meet business needs to work with date and time, structured, semi-structured, and unstructured data. These are documented in SQL Server 2008 Books Online.

The SQL Server data types that are available for use in your application depends on the version of SQL Server that you are using. For more information, see the relevant version of SQL Server Books Online in the following table.

SQL Server Books Online

  1. Data Types (Database Engine)

In This Section

SqlTypes and the DataSet
Describes type support for SqlTypes in the DataSet.

Handling Null Values
Demonstrates how to work with null values and three-valued logic.

Comparing GUID and uniqueidentifier Values
Demonstrates how to work with GUID and uniqueidentifier values in SQL Server and the .NET Framework.

Date and Time Data
Describes how to use the new date and time data types introduced in SQL Server 2008.

Large UDTs
Demonstrates how to retrieve data from large value UDTs introduced in SQL Server 2008.

XML Data in SQL Server
Describes how to work with XML data retrieved from SQL Server.

Reference

DataSet
Describes the DataSet class and all of its members.

System.Data.SqlTypes
Describes the SqlTypes namespace and all of its members.

SqlDbType
Describes the SqlDbType enumeration and all of its members.

DbType
Describes the DbType enumeration and all of its members.

See Also

SQL Server Data Type Mappings
Configuring Parameters and Parameter Data Types
Table-Valued Parameters
SQL Server Binary and Large-Value Data
ADO.NET Managed Providers and DataSet Developer Center