SqlDbType SqlDbType SqlDbType SqlDbType Enum

定义

指定要用于 SqlParameter 中的字段和属性的 SQL Server 特定的数据类型。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
继承

字段

BigInt BigInt BigInt BigInt 0

Int64Int64. 64 位带符号整数。A 64-bit signed integer.

Binary Binary Binary Binary 1

Array类型ByteArray of type Byte. 二进制数据的固定长度流,范围在 1 到 8,000 个字节之间。A fixed-length stream of binary data ranging between 1 and 8,000 bytes.

Bit Bit Bit Bit 2

BooleanBoolean. 无符号数值,可为 0、1 或 nullAn unsigned numeric value that can be 0, 1, or null.

Char Char Char Char 3

StringString. 非 Unicode 字符的固定长度流,范围在 1 到 8,000 个字符之间。A fixed-length stream of non-Unicode characters ranging between 1 and 8,000 characters.

Date Date Date Date 31

日期数据,值范围从公元 1 年 1 月 1 日到公元 9999 年 12 月 31 日。Date data ranging in value from January 1,1 AD through December 31, 9999 AD.

DateTime DateTime DateTime DateTime 4

DateTimeDateTime. 日期和时间数据,值范围从 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 DateTime2 DateTime2 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 DateTimeOffset DateTimeOffset 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 Decimal Decimal Decimal 5

DecimalDecimal. 固定精度和小数位数数值,在 -10 38 -1 和 10 38 -1 之间。A fixed precision and scale numeric value between -10 38 -1 and 10 38 -1.

Float Float Float Float 6

DoubleDouble. 浮点数在 -1.79E +308 到 1.79E +308 的范围内。A floating point number within the range of -1.79E +308 through 1.79E +308.

Image Image Image Image 7

Array类型ByteArray 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 Int Int Int 8

Int32Int32. 32 位带符号整数。A 32-bit signed integer.

Money Money Money Money 9

DecimalDecimal. 货币值,范围在 -2 63(即 -922,337,203,685,477.5808)到 2 63 -1(即 +922,337,203,685,477.5807)之间,精度为千分之十个货币单位。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 NChar NChar NChar 10

StringString. Unicode 字符的固定长度流,范围在 1 到 4,000 个字符之间。A fixed-length stream of Unicode characters ranging between 1 and 4,000 characters.

NText NText NText NText 11

StringString. 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 NVarChar NVarChar NVarChar 12

StringString. 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 Real Real Real 13

SingleSingle. -3.40E +38 到 3.40E +38 范围内的浮点数。A floating point number within the range of -3.40E +38 through 3.40E +38.

SmallDateTime SmallDateTime SmallDateTime SmallDateTime 15

DateTimeDateTime. 日期和时间数据,值范围从 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 SmallInt SmallInt SmallInt 16

Int16Int16. 16 位带符号整数。A 16-bit signed integer.

SmallMoney SmallMoney SmallMoney SmallMoney 17

DecimalDecimal. 货币值,范围在 -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 Structured Structured Structured 30

一种特殊数据类型,用于指定表值参数中包含的构造数据。A special data type for specifying structured data contained in table-valued parameters.

Text Text Text Text 18

StringString. 非 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 Time Time 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 Timestamp Timestamp Timestamp 19

Array类型ByteArray 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 TinyInt TinyInt TinyInt 20

ByteByte. 8 位无符号整数。An 8-bit unsigned integer.

Udt Udt Udt Udt 29

SQL Server 用户定义类型 (UDT)。A SQL Server user-defined type (UDT).

UniqueIdentifier UniqueIdentifier UniqueIdentifier UniqueIdentifier 14

GuidGuid. 全局唯一标识符(或 GUID)。A globally unique identifier (or GUID).

VarBinary VarBinary VarBinary VarBinary 21

Array类型ByteArray 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. 使用大于 8000 个字节的字节数组时,请显式设置对象。Explicitly set the object when working with byte arrays larger than 8,000 bytes.

VarChar VarChar VarChar VarChar 22

StringString. 非 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 Variant Variant Variant 23

ObjectObject. 特殊数据类型,可以包含数值、字符串、二进制或日期数据,以及 SQL Server 值 Empty 和 Null,后两个值在未声明其他类型的情况下采用。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 Xml Xml Xml 25

XML 值。An XML value. 使用 GetValue(Int32) 方法或 Value 属性获取字符串形式的 XML,或通过调用 CreateReader() 方法获取 XmlReader 形式的 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为支持SqlDbTypeTherefore, setting the DbType changes the SqlDbType to a supporting SqlDbType.

适用于

另请参阅