映射 CLR 参数数据
http://msdn.microsoft.com/zh-cn/library/ms131092(v=sql.100).aspxs
下表列出了 MicrosoftSQL Server 数据类型、它们在 SQL Server 公共语言运行时 (CLR) 的 System.Data.SqlTypes 命名空间中的等效类型,以及它们在 Microsoft .NET Framework 中的本机 CLR 等效类型。
SQL Server 数据类型 |
CLR 数据类型 (SQL Server) |
CLR 数据类型 (.NET Framework) |
bigint |
SqlInt64 |
Int64, Nullable<Int64> |
binary |
SqlBytes, SqlBinary |
Byte[] |
bit |
SqlBoolean |
Boolean, Nullable<Boolean> |
char |
无 |
无 |
cursor |
无 |
无 |
date |
SqlDateTime |
DateTime, Nullable<DateTime> |
datetime |
SqlDateTime |
DateTime, Nullable<DateTime> |
datetime2 |
SqlDateTime |
DateTime, Nullable<DateTime> |
DATETIMEOFFSET |
None |
DateTimeOffset, Nullable<DateTimeOffset> |
decimal |
SqlDecimal |
Decimal, Nullable<Decimal> |
float |
SqlDouble |
Double, Nullable<Double> |
geography |
SqlGeography SqlGeography 在 Microsoft.SqlServer.Types.dll 中定义,该文件随 SQL Server 一起安装,并且可以从 SQL Server 2008 功能包下载。 |
无 |
geometry |
SqlGeometry SqlGeometry 在 Microsoft.SqlServer.Types.dll 中定义,该文件随 SQL Server 一起安装,并且可以从 SQL Server 2008 功能包下载。 |
无 |
hierarchyid |
SqlHierarchyId SqlHierarchyId 在 Microsoft.SqlServer.Types.dll 中定义,该文件随 SQL Server 一起安装,并且可以从 SQL Server 2008 功能包下载。 |
无 |
image |
无 |
无 |
int |
SqlInt32 |
Int32, Nullable<Int32> |
money |
SqlMoney |
Decimal, Nullable<Decimal> |
nchar |
SqlChars, SqlString |
String, Char[] |
ntext |
无 |
无 |
numeric |
SqlDecimal |
Decimal, Nullable<Decimal> |
nvarchar |
SqlChars, SqlString SQLChars 更适合用于数据传输和访问,而 SQLString 更适合用于执行字符串运算。 |
String, Char[] |
nvarchar(1), nchar(1) |
SqlChars, SqlString |
Char, String, Char[], Nullable<char> |
real |
SqlSingle |
Single, Nullable<Single> |
rowversion |
无 |
Byte[] |
smallint |
SqlInt16 |
Int16, Nullable<Int16> |
smallmoney |
SqlMoney |
Decimal, Nullable<Decimal> |
sql_variant |
无 |
Object |
table |
无 |
无 |
text |
无 |
无 |
time |
TimeSpan |
TimeSpan, Nullable<TimeSpan> |
timestamp |
无 |
无 |
tinyint |
SqlByte |
Byte, Nullable<Byte> |
uniqueidentifier |
SqlGuid |
Guid, Nullable<Guid> |
User-defined type(UDT) |
无 |
绑定到相同程序集或依赖程序集中的用户定义类型的相同类。 |
varbinary |
SqlBytes, SqlBinary |
Byte[] |
varbinary(1), binary(1) |
SqlBytes, SqlBinary |
byte, Byte[], Nullable<byte> |
varchar |
无 |
无 |
xml |
SqlXml |
无 |