データ型一覧

いつも探し回るのでメモ

データ型 SqlDbType 説明 サイズ
bigint Int64 -2^63 (-9,223,372,036,854,775,808) 〜2^63-1 (9,223,372,036,854,775,807) 8 Bytes
int Int32 -2^31 (-2,147,483,648) 〜 2^31-1 (2,147,483,647) 4 Bytes
smallint Int16 -2^15 (-32,768) 〜 2^15-1 (32,767) 2 Bytes
tinyint Byte 0 〜 255(Unsigned) 1 Byte
bit Boolean 0、1、NULL のいずれか。複数の列がある場合は、8bit ごとにパックされる。 可変
decimal Decimal 固定長の有効桁数と小数点以下桁数を指定した固定小数点データ。十進での最大有効桁数は、38桁。デフォルトでは18桁。 可変
numeric Decimal decimal型と同じ 可変
money Decimal -922,337,203,685,477.5808 〜 922,337,203,685,477.5807 8 Bytes
smallmoney Decimal - 214,748.3648 〜 214,748.3647 4 Bytes
float [ ( n ) ] Double 倍精度浮動小数点実数。 4 Bytes(1<=n<=24)
real Signle 単精度浮動小数点実数。float(24)と同じ。 4 Bytes
datetime DateTime 1753年1月1日〜9999年12月31日 4 Bytes
smalldatetime DateTime 1900年1月1日〜2079年6月6日 2 Bytes
char [ ( n ) ] String Unicode固定長文字列。nは、1から8000まで。 可変
text String Unicode可変長文字列。最大2,147,483,647文字まで。将来削除予定 可変
varchar String Unicode可変長文字列。nは、1から4000まで。 可変
nchar [ ( n ) ] String Unicode固定長文字列。nは、1~4000まで。 可変
ntext String Unicode可変長文字列。最大30 - 1 (1,073,741,823)文字まで。UNICODE UCS-2 character set。将来削除予定 可変
nvarchar String Unicode可変長文字列。nは、1から4000まで。 可変
binary [ ( n ) ] Byte[] 固定長バイナリデータ。nは、1~8000まで。 固定長
varbinary [ ( n max) ] Byte[] 可変長バイナリデータ。nは、1から8000まで。 可変
image Byte[] 可変長バイナリデータ。最大2,147,483,647bytes。将来削除予定 可変
timestamp Byte [] 行が更新されたときに値が更新されるタイムスタンプとして使われることが多い。 8 bytes
uniqueidentifier Guid 16-byte のGUID (globally unique identifier). 16bytes
xml XML value xmlデータを格納するためのデータ型。xmlインスタンスまたxml型の変数を列に格納できる。 可変

SQL Server 2000 / データ型・定義
上記から引用しました。