|
資料型別 |
位元數 |
資料範圍 |
|
tinyint |
1 Byte |
0 ~ 2^8 -1 |
|
smallint |
2 Bytes |
-2^15 ~ 2^15-1 |
|
int |
4 Bytes |
-2^31 ~ 2^31 -1 |
|
bigint |
8 Bytes |
-2^63~2^63 -1 |
|
bit |
1 Byte |
0 , 1 , Null |
精確位數與浮點數
|
資料型別 |
位元數 |
資料範圍 |
|
numeric |
視精確度而定 |
-10^38 +1 ~ 10^38 -1 |
|
decimal |
視精確度而定 |
-10^38 +1 ~ 10^38 -1 |
|
float |
8 Bytes |
-1.79E+308 ~ 1.79E+308 |
|
real |
4 Bytes |
-3.40E+38 ~ 3.40E+38 |
字串 - Unicode 字串 - Binary 字串
|
資料型別 |
位元數 |
資料範圍 |
|
char(n) |
1字元 1Byte |
1 ~ 8000 字元 |
|
varchar(n) |
1字元 1Byte |
1 ~ 8000 字元 |
|
varchar(max) |
變動長度 max=2GB |
1 ~ 2^31 -1 字元 |
|
text |
變動長度 max=2GB |
1 ~ 2^31 -1 字元 |
|
nchar(n) |
1字元 2Byte |
1 ~ 4000 字元 |
|
nvarchar(n) |
1字元 2Byte |
1 ~ 4000 字元 |
|
nvarchar(max) |
1字元 2Byte |
1 ~ 2^30 -1 字元 |
|
ntext |
1字元 2Byte |
1 ~ 2^30 -1 字元 |
|
binary(n) |
固定長度 8000 Bytes,不足自動補上 0x00 |
1 ~ 8000 Bytes |
|
varbinary(n) |
變動長度 |
1 ~ 8000 Bytes |
|
varbinary(max) |
變動長度 max=2GB |
1 ~ 2^31 -1 Bytes |
|
image |
變動長度 max=2GB |
1 ~ 2^31 -1 Bytes |
日期 - 時間 - 貨幣 - Timestamp
|
資料型別 |
位元數 |
資料範圍 |
|
datatime |
8 Bytes |
1753/1/1 ~ 9999/12/31 |
|
smalldatatime |
4 Bytes |
1900/1/1 ~ 2079/6/6 |
|
money |
8 Bytes |
-2^63 ~ 2^63 -1 小數4位 |
|
smallmoney |
4 Bytes |
-2^31 ~ 2^31 -1 小數4位 |
|
timestamp |
8 Bytes |
8 Bytes 的 16 進位值 |
|
uniqueidentifier |
16 Bytes |
16 Bytes 的 16 進位值 |
