SQL SERVER資料型別與C 資料型別對照表

2021-06-21 13:59:23 字數 2327 閱讀 5449

**:

sql server型別

c#型別

精確數字

bigint

從 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型資料(所有數字)。儲存大小為 8 個位元組。

int64

int從 -2^31 (-2,147,483,648) 到 2^31 - 1 (2,147,483,647) 的整型資料(所有數字)。儲存大小為 4 個位元組。int的 sql-92 同義字為integer

int32

smallint

從 -2^15 (-32,768) 到 2^15 - 1 (32,767) 的整型資料。儲存大小為 2 個位元組。

int16

tinyint

從 0 到 255 的整型資料。儲存大小為 1 位元組。

system.byte

bit1 或 0 的整數資料。

boolean

decimal

從 -10^38 +1 到 10^38 –1 的固定精度和小數字的數字資料。

system.decimal

numeric

功能上等同於decimal

system.decimal

money

貨幣資料值介於 -2^63 (-922,337,203,685,477.5808) 與 2^63 - 1 (+922,337,203,685,477.5807) 之間,精確到貨幣單位的千分之十。

system.decimal

smallmoney

貨幣資料值介於 -214,748.3648 與 +214,748.3647 之間,精確到貨幣單位的千分之十。

system.decimal

近似數字

float

從 -1.79e + 308 到 1.79e + 308 的浮點精度數字。

system.double

real

從 -3.40e + 38 到 3.40e + 38 的浮點精度數字。

system.single

datetime

從 1753 年 1 月 1 日到 9999 年 12 月 31 日的日期和時間資料,精確到百分之三秒(或 3.33 毫秒)。

system.datetime

smalldatetime

從 1900 年 1 月 1 日到 2079 年 6 月 6 日的日期和時間資料,精確到分鐘。

system.datetime

字串char

固定長度的非 unicode 字元資料,最大長度為 8,000 個字元。

string

varchar

可變長度的非 unicode 資料,最長為 8,000 個字元。

string

text

可變長度的非 unicode 資料,最大長度為 2^31 - 1 (2,147,483,647) 個字元。

string

unicode 字串

nchar

固定長度的 unicode 資料,最大長度為 4,000 個字元。

string

nvarchar

可變長度 unicode 資料,其最大長度為 4,000 字元。sysname是系統提供使用者定義的資料型別,在功能上等同於nvarchar(128),用於引用資料庫物件名。

string

ntext

可變長度 unicode 資料,其最大長度為 2^30 - 1 (1,073,741,823) 個字元。

string

二進位制字串

binary

固定長度的二進位制資料,其最大長度為 8,000 個位元組。

system.byte

varbinary

可變長度的二進位制資料,其最大長度為 8,000 個位元組。

system.byte

image

可變長度的二進位制資料,其最大長度為 2^31 - 1 (2,147,483,647) 個位元組。

system.byte

其它資料型別

timestamp

資料庫範圍的唯一數字,每次更新行時也進行更新。

system.datetime

uniqueidentifier

全域性唯一識別符號 (guid)。

system.guid

variant

object

SQL SERVER資料型別與C 資料型別對照表

sql server 型別 c 型別 精確數字 bigint 從 2 63 9223372036854775808 到2 63 1 9223372036854775807 的整型資料 所有數字 儲存大小為 8 個位元組。int64 int 從 2 31 2,147,483,648 到2 31 1 2...

SQL SERVER資料型別與C 資料型別對照表

sql server 資料型別與 c 資料型別對照表 sql server型別 c 型別 精確數字 bigint 從 2 63 9223372036854775808 到 2 63 1 9223372036854775807 的整型資料 所有數字 儲存大小為 8 個位元組。int64 int從 2 ...

SqlServer資料型別

資料型別 型別 描 述 bit 整型 bit資料型別是整型,其值只能是0 1或空值。這種資料型別用於儲存只有兩種可能值的資料,如yes 或no true 或fa lse on 或off int 整型 int資料型別可以儲存從 231 2147483648 到231 2147483 647 之間的整數...