SQL Server型態與C# Mapping (SQL2000/SQL2005/SQL2008/SQL2012)

下列整理從SQL2000~SQL2012的資料型態與C#對應關係:
需下載我放再協作平台上面此文章整理時產出的Excel檔案,請到這邊下載:連結
SQL2008~SQL2012 SQL2005 SQL2000 C#資料型態
bigint bigint bigint Int64, Nullable
binary binary binary Byte[]
bit bit bit Boolean, Nullable
char char char None
cursor cursor cursor None
date DateTime, Nullable
datetime datetime datetime DateTime, Nullable
datetime2 DateTime, Nullable
DATETIMEOFFSET DateTimeOffset, Nullable
decimal decimal decimal Decimal, Nullable
float float float Double, Nullable
geography None
geometry None
hierarchyid None
image image image None
int int int Int32, Nullable
money money money Decimal, Nullable
nchar nchar nchar String, Char[]
ntext ntext ntext None
numeric numeric numeric Decimal, Nullable
nvarchar nvarchar nvarchar String, Char[]
nvarchar(1), nchar(1) nvarchar(1), nchar(1) nvarchar(1), nchar(1) Char, String, Char[], Nullable
real real real Single, Nullable
rowversion rowversion rowversion Byte[]
smallint smalldatetime smalldatetime Int16, Nullable
smallmoney smallint smallint Decimal, Nullable
sql_variant smallmoney smallmoney Object
table sql_variant sql_variant None
text table table None
time text text TimeSpan, Nullable
timestamp timestamp timestamp None
tinyint tinyint tinyint Byte, Nullable
uniqueidentifier uniqueidentifier uniqueidentifier Guid, Nullable
User-defined type(UDT) User-defined type(UDT) User-defined type(UDT) The same class that is bound to the user-defined type in the same assembly or a dependent assembly.
varbinary varbinary varbinary Byte[]
varbinary(1), binary(1) varbinary(1), binary(1) varbinary(1), binary(1) byte, Byte[], Nullable
varchar varchar varchar None
xml xml None

1 則留言:

Hugo.Life 提到...

有更新喔~
http://msdn.microsoft.com/en-us/library/cc716729.aspx

橫式廣告