C#等价于SQL Server数据types

对于以下SQL Server数据types,C#中相应的数据types是什么?

精确的数字

bigint numeric bit smallint decimal smallmoney int tinyint money 

近似数字

 float real 

date和时间

 date datetimeoffset datetime2 smalldatetime datetime time 

string

 char varchar text 

Unicode字符string

 nchar nvarchar ntext 

二进制string

 binary varbinary image 

其他数据types

 cursor timestamp hierarchyid uniqueidentifier sql_variant xml table 

(来源: MSDN )

这是针对SQL Server 2005的 。 有SQL Server 2008 , SQL Server 2008 R2 , SQL Server 2012和SQL Server 2014的表的更新版本。

SQL Server数据types及其.NET Framework等价物

下表列出了Microsoft SQL Server数据types及其在System.Data.SqlTypes命名空间中用于SQL Server的公共语言运行库(CLR)中的等效项,以及Microsoft .NET Framework中的本机CLR等效项。

 SQL Server data type CLR data type (SQL Server) CLR data type (.NET Framework) varbinary SqlBytes, SqlBinary Byte[] binary SqlBytes, SqlBinary Byte[] varbinary(1), binary(1) SqlBytes, SqlBinary byte, Byte[] image None None varchar None None char None None nvarchar(1), nchar(1) SqlChars, SqlString Char, String, Char[] nvarchar SqlChars, SqlString String, Char[] nchar SqlChars, SqlString String, Char[] text None None ntext None None uniqueidentifier SqlGuid Guid rowversion None Byte[] bit SqlBoolean Boolean tinyint SqlByte Byte smallint SqlInt16 Int16 int SqlInt32 Int32 bigint SqlInt64 Int64 smallmoney SqlMoney Decimal money SqlMoney Decimal numeric SqlDecimal Decimal decimal SqlDecimal Decimal real SqlSingle Single float SqlDouble Double smalldatetime SqlDateTime DateTime datetime SqlDateTime DateTime sql_variant None Object User-defined type(UDT) None user-defined type table None None cursor None None timestamp None None xml SqlXml None 

SQL Server和.NET Framework基于不同的types系统。 例如,.NET Framework Decimal结构的最大比例为28,而SQL Server小数和数字数据types的最大比例为38.单击此处链接 ! 为细节

https://msdn.microsoft.com/en-us/library/cc716729(v=vs.110).aspx