2015年7月15日水曜日

SQLServerの型と.NET型のマッピング

SQLServerの型と.NET型のマッピング


内容サイズ.NETの型
bit1、0、または NULL の値をとる整数型1Boolean
decimal- 10^38 +1 ~ 10^38 - 1 5~17Decimal
numeric- 10^38 +1 ~ 10^38 - 1 (decimal のシノニム)5~17Decimal
bigint-2^63 (-9,223,372,036,854,775,808) ~ 2^63-1 (9,223,372,036,854,775,807)8Int64
int-2^31 (-2,147,483,648) ~ 2^31-1 (2,147,483,647)4Int32
smallint-2^15 (-32,768) ~ 2^15-1 (32,767)2Int16
tinyint0 ~ 2551Byte
money-922,337,203,685,477.5808 ~ 922,337,203,685,477.58078Decimal
smallmoney- 214,748.3648 ~ 214,748.36474Decimal
float- 1.79E+308 ~ -2.23E-308、0、および 2.23E-308 ~ 1.79E+3084 or 8Decimal
real- 3.40E+38 ~ -1.18E-38、0、および 1.18E-38 ~ 3.40E+384Decimal
Date0001-01-01 ~ 9999-12-313DateTime
datetime20001-01-01 ~ 9999-12-31 00:00:00 ~ 23:59:59.99999996~8DateTime
datetime1753 年 1 月 1 日~ 9999 年 12 月 31 日 00:00:00 ~ 23:59:59.9978DateTime
datetimeoffset0001-01-01 ~ 9999-12-31 00:00:00 ~ 23:59:59.99999998~10DateTimeOffset
smalldatetime1900-01-01 ~ 2079-06-06 00:00:00 ~ 23:59:594DateTime
Time00:00:00.0000000 ~ 23:59:59.99999993~5TimeSpan
char固定長の文字列データ最大長8000String
text可変長の非 Unicode データ (最大長が2^31-1文字)最大長2GBString
varcharUnicode ではない可変長の文字列データ最大長8000String
nchar固定長の Unicode 文字列データ最大長8000String
ntext文字列の最大長が 2^30 - 1 (1,073,741,823) の可変長の Unicode データ最大長2GBString
nvarchar可変長の Unicode 文字列データ最大長8000String
binary長さ n バイトの固定長のバイナリ データ最大長8004Byte[]
varbinary可変長 binary データ最大長8004Byte[]
image0 ~ 2^31-1 (2,147,483,647) バイトの可変長のバイナリ データ最大長2GBByte[]

0 件のコメント:

コメントを投稿