SqlDbType 列舉

定義

指定欄位的 SQL Server 特定的資料型別與屬性,以便在 SqlParameter 中使用。Specifies SQL Server-specific data type of a field, property, for use in a SqlParameter.

public enum class SqlDbType
public enum SqlDbType
type SqlDbType = 
Public Enum SqlDbType
繼承
SqlDbType

欄位

BigInt 0

Int64.Int64. 64 位元帶正負號的整數。A 64-bit signed integer.

Binary 1

型別 ArrayByteArray of type Byte. 二進位資料的固定長度資料流,範圍在 1 和 8,000 位元組之間。A fixed-length stream of binary data ranging between 1 and 8,000 bytes.

Bit 2

Boolean.Boolean. 不帶正負號的數值,這個值可以是 0、1 或 nullAn unsigned numeric value that can be 0, 1, or null.

Char 3

String.String. 非 Unicode 字元的固定長度資料流,範圍在 1 到 8,000 個字元之間。A fixed-length stream of non-Unicode characters ranging between 1 and 8,000 characters.

Date 31

日期資料範圍是從西元 1 年 1 月 1 日到西元 9999 年 12 月 31 日。Date data ranging in value from January 1,1 AD through December 31, 9999 AD.

DateTime 4

DateTime.DateTime. 日期和時間資料,值範圍從 1753 年 1 月 1 日到 9999 年 12 月 31 日,正確率為 3.33 毫秒。Date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds.

DateTime2 33

日期和時間資料。Date and time data. 日期值範圍是從西元後 1 年 1 月 1 日到西元後 9999 年 12 月31 日。Date value range is from January 1,1 AD through December 31, 9999 AD. 時間值的範圍從 00:00:00 到 23:59:59.9999999,精確度為 100 奈秒。Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds.

DateTimeOffset 34

具備時區感知功能的日期和時間資料。Date and time data with time zone awareness. 日期值範圍是從西元後 1 年 1 月 1 日到西元後 9999 年 12 月31 日。Date value range is from January 1,1 AD through December 31, 9999 AD. 時間值的範圍從 00:00:00 到 23:59:59.9999999,精確度為 100 奈秒。Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. 時區值範圍從 -14:00 到 +14:00。Time zone value range is -14:00 through +14:00.

Decimal 5

Decimal.Decimal. 固定的有效位數及小數位數值,介於 -10 38 -1 和 10 38 -1 之間。A fixed precision and scale numeric value between -10 38 -1 and 10 38 -1.

Float 6

Double.Double. 浮點數,範圍為 -1.79E +308 到 1.79E +308。A floating point number within the range of -1.79E +308 through 1.79E +308.

Image 7

型別 ArrayByteArray of type Byte. 二進位資料的可變長度資料流,範圍從 0 到 2 31 -1 (或 2,147,483,647) 個位元組。A variable-length stream of binary data ranging from 0 to 2 31 -1 (or 2,147,483,647) bytes.

Int 8

Int32.Int32. 32 位元帶正負號的整數。A 32-bit signed integer.

Money 9

Decimal.Decimal. 貨幣值,範圍從 -2 63 (或 -9,223,372,036,854,775,808) 到 2 63 -1 (或 +9,223,372,036,854,775,807),正確率為貨幣單位的千分之十。A currency value ranging from -2 63 (or -9,223,372,036,854,775,808) to 2 63 -1 (or +9,223,372,036,854,775,807) with an accuracy to a ten-thousandth of a currency unit.

NChar 10

String.String. Unicode 字元的固定長度資料流,範圍在 1 到 4,000 個字元之間。A fixed-length stream of Unicode characters ranging between 1 and 4,000 characters.

NText 11

String.String. Unicode 資料的可變長度資料流,具有 2 30 - 1 (或 1,073,741,823) 個字元的最大長度。A variable-length stream of Unicode data with a maximum length of 2 30 - 1 (or 1,073,741,823) characters.

NVarChar 12

String.String. Unicode 字元的可變長度資料流,範圍在 1 到 4,000 個字元之間。A variable-length stream of Unicode characters ranging between 1 and 4,000 characters. 如果字串大於 4,000 個字元,則隱含轉換會失敗。Implicit conversion fails if the string is greater than 4,000 characters. 當使用大於 4,000 個字元的字串時,明確設定物件。Explicitly set the object when working with strings longer than 4,000 characters. 當資料庫資料行是 nvarchar(max) 時,請使用 NVarCharUse NVarChar when the database column is nvarchar(max).

Real 13

Single.Single. 浮點數,範圍為 -3.40E +38 到 3.40E +38。A floating point number within the range of -3.40E +38 through 3.40E +38.

SmallDateTime 15

DateTime.DateTime. 日期和時間資料,值範圍從 1900 年 1 月 1 日到 2079 年 6 月 6 日,正確率為 1 分鐘。Date and time data ranging in value from January 1, 1900 to June 6, 2079 to an accuracy of one minute.

SmallInt 16

Int16.Int16. 16 位元帶正負號的整數。A 16-bit signed integer.

SmallMoney 17

Decimal.Decimal. 貨幣值,範圍從 -214,748.3648 到 +214,748.3647,正確率為貨幣單位的千分之十。A currency value ranging from -214,748.3648 to +214,748.3647 with an accuracy to a ten-thousandth of a currency unit.

Structured 30

特殊資料型別,可指定資料表值參數所包含的結構化資料。A special data type for specifying structured data contained in table-valued parameters.

Text 18

String.String. 非 Unicode 資料的可變長度資料流,具有 2 31 - 1 (或 2,147,483,647) 個字元的最大長度。A variable-length stream of non-Unicode data with a maximum length of 2 31 -1 (or 2,147,483,647) characters.

Time 32

24 小時制的時間資料。Time data based on a 24-hour clock. 時間值的範圍從 00:00:00 到 23:59:59.9999999,精確度為 100 奈秒。Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. 對應至 SQL Server time 值。Corresponds to a SQL Server time value.

Timestamp 19

型別 ArrayByteArray of type Byte. 自動產生的二進位號碼,保證都是資料庫內唯一的號碼Automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp 通常用來當做為版本戳記表格列的機制。timestamp is used typically as a mechanism for version-stamping table rows. 儲存區大小為 8 位元組。The storage size is 8 bytes.

TinyInt 20

Byte.Byte. 8 位元不帶正負號的整數。An 8-bit unsigned integer.

Udt 29

SQL Server 使用者定義型別 (UDT)。A SQL Server user-defined type (UDT).

UniqueIdentifier 14

Guid.Guid. 全域唯一識別項 (或 GUID)。A globally unique identifier (or GUID).

VarBinary 21

型別 ArrayByteArray of type Byte. 二進位資料的可變長度資料流,範圍在 1 和 8,000 位元組之間。A variable-length stream of binary data ranging between 1 and 8,000 bytes. 如果位元組陣列大於 8,000 個位元組,則隱含轉換會失敗。Implicit conversion fails if the byte array is greater than 8,000 bytes. 在使用大於 8,000 個位元組的位元組陣列時,明確設定物件。Explicitly set the object when working with byte arrays larger than 8,000 bytes.

VarChar 22

String.String. 非 Unicode 字元的可變長度資料流,範圍在 1 和 8,000 字元之間。A variable-length stream of non-Unicode characters ranging between 1 and 8,000 characters. 當資料庫資料行是 varchar(max) 時,請使用 VarCharUse VarChar when the database column is varchar(max).

Variant 23

Object.Object. 特殊的資料型別,可以包含數值、字串、二進位或日期資料,以及 Empty 和 Null 等 SQL Server 值 (如果未宣告其他型別,則會假定為這個型別)。A special data type that can contain numeric, string, binary, or date data as well as the SQL Server values Empty and Null, which is assumed if no other type is declared.

Xml 25

XML 值。An XML value. 使用 GetValue(Int32) 方法或 Value 屬性取得 XML 做為字串,或呼叫 XmlReader 方法 CreateReader() 取得 XML 做為字串。Obtain the XML as a string using the GetValue(Int32) method or Value property, or as an XmlReader by calling the CreateReader() method.

備註

當設定命令參數時, SqlDbTypeDbType會連結。When setting command parameters, the SqlDbType and DbType are linked. 因此, DbType會將SqlDbType變更為支援SqlDbType的。Therefore, setting the DbType changes the SqlDbType to a supporting SqlDbType.

適用於

另請參閱