DataType 枚举

指示数据流组件和数据流缓冲区中列的数据类型。

命名空间:  Microsoft.SqlServer.Dts.Runtime.Wrapper
程序集:  Microsoft.SqlServer.DTSRuntimeWrap(在 Microsoft.SqlServer.DTSRuntimeWrap.dll 中)

语法

声明
Public Enumeration DataType
用法
Dim instance As DataType
public enum DataType
public enum class DataType
type DataType
public enum DataType

成员

成员名称 说明
DT_EMPTY 不具有值的数据类型。该数值为 0。
DT_NULL 值为 NULL 的数据类型。该数值为 1。
DT_I2 2 字节的有符号整数。该数值为 2。
DT_I4 4 字节的有符号整数。该数值为 3。
DT_R4 单精度浮点值。该数值为 4。
DT_R8 双精度浮点值。该数值为 5。
DT_CY 货币值。此数据类型为 8 字节值,其小数位数为 4,最大精度为 19。该数值为 6。
DT_DATE 由年、月、日和小时组成的日期结构。

The DT_DATE data type is implemented using an 8-byte floating-point number. Days are represented by whole number increments, starting with 30 December 1899, and midnight as time zero. Hour values are expressed as the absolute value of the fractional part of the number. This means that DT_DATE can represent minutes, seconds, and even milliseconds as well. However, floating point value cannot represent all real values; therefore, there are limits on the range of dates that can be presented in DT_DATE.

On the other hand, DT_DBTIMESTAMP is represented by a structure that has individual fields for year, month, day, hours, minutes, seconds, and milliseconds, and this data type has no limits on ranges of the dates it can present.

The numeric value is 7.

DT_BOOL 一个布尔值。该数值为 11。
DT_DECIMAL 精度和小数位数均固定的精确数值。此数据类型为具有单独符号的 12 字节值,其小数位数为 0 到 28,最大精度为 29。该数值为 14。
DT_I1 1 字节的有符号整数。该数值为 16。
DT_UI1 1 字节的无符号整数。该数值为 17。
DT_UI2 2 字节的无符号整数。该数值为 18。
DT_UI4 4 字节的无符号整数。该数值为 19。
DT_I8 8 字节的有符号整数。该数值为 20。
DT_UI8 8 字节的无符号整数。该数值为 21。
DT_FILETIME 一个 64 位值,表示从 1601 年 1 月 1 日起长度为 100 纳秒的间隔的数量。该数值为 64。
DT_GUID 全局唯一标识符 (GUID)。该数值为 72。
DT_BYTES 二进制数据值。长度可变,且最大长度为 8000 字节。该数值为 128。
DT_STR 以 Null 值结束的 ANSI/MBCS 字符串。该数值为 129。
DT_WSTR 以 Null 值结束的 Unicode 字符串。该数值为 130。
DT_NUMERIC 精度和小数位数均固定的精确数值。此数据类型为具有单独符号的 16 字节值,其小数位数为 0 到 38,最大精度为 38。该数值为 131。
DT_DBDATE 由年、月和日组成的日期结构。该数值为 133。
DT_DBTIME 由小时、分钟和秒组成的时间结构。该数值为 134。
DT_DBTIMESTAMP 由年、月、日、小时、分钟、秒和小数秒组成的时间戳结构。小数秒的最大小数位数为 3。该数值为 135。
DT_DBTIME2 由小时、分钟、秒和小数秒组成的时间结构。小数秒的最大小数位数为 7。该数值为 145。
DT_DBTIMESTAMPOFFSET 由年、月、日、小时、分钟、秒和小数秒组成的时间戳结构。小数秒的最大小数位数为 7。

The DT_DBTIMESTAMPOFFSET data type also has a time zone offset. This offset specifies the number of hours and minutes that the time is offset from the Coordinated Universal Time (UTC). The time zone offset is used by the system to obtain the local time.

The numeric value is 146.

DT_IMAGE 二进制值,最大大小为 231–1 (2,147,483,647) 个字节。该数值为 301。
DT_TEXT ANSI/MBCS 字符串,最大长度为 231–1 (2,147,483,647) 个字符。该数值为 302。
DT_NTEXT Unicode 字符串,最大长度为 2^30–1 (1,073,741,823) 个字符。该数值为 303。
DT_DBTIMESTAMP2 由年、月、日、小时、分钟、秒和小数秒组成的时间戳结构。小数秒的最大小数位数为 7。该数值为 304。
DT_BYREF_I2 指向 2 字节的有符号整数的指针。该数值为 16386。
DT_BYREF_I4 指向 4 字节的有符号整数的指针。该数值为 16387。
DT_BYREF_R4 指向单精度浮点值的指针。该数值为 16388。
DT_BYREF_R8 指向双精度浮点值的指针。该数值为 16389。
DT_BYREF_CY 指向货币值的指针。此数据类型为 8 字节值,其小数位数为 4,最大精度为 19。该数值为 16390。
DT_BYREF_DATE 指向由年、月、日和小时组成的日期结构的指针。该数值为 16391。
DT_BYREF_BOOL 指向布尔值的指针。该数值为 16395。
DT_BYREF_DECIMAL 指向具有固定精度和固定小数位数的精确数值的指针。此数据类型为具有单独符号的 12 字节值,其小数位数为 0 到 28,最大精度为 29。该数值为 16398。
DT_BYREF_I1 指向 1 字节的有符号整数的指针。该数值为 16400。
DT_BYREF_UI1 指向 1 字节的无符号整数的指针。该数值为 16401。
DT_BYREF_UI2 指向 2 字节的无符号整数的指针。该数值为 16402。
DT_BYREF_UI4 指向 4 字节的无符号整数的指针。该数值为 16403。
DT_BYREF_I8 指向 8 字节的有符号整数的指针。该数值为 16404。
DT_BYREF_UI8 指向 8 字节的无符号整数的指针。该数值为 16405。
DT_BYREF_FILETIME 指向一个 64 位值的指针,该值表示从 1601 年 1 月 1 日起长度为 100 纳秒的间隔的数量。该数值为 16448。
DT_BYREF_GUID 指向 GUID 的指针。该数值为 16456。
DT_BYREF_NUMERIC 指向具有固定精度和小数位数的精确数值的指针。此数据类型为具有单独符号的 16 字节值,其小数位数为 0 到 38,最大精度为 38。该数值为 16515。
DT_BYREF_DBDATE 指向由年、月和日组成的日期结构的指针。该数值为 16517。
DT_BYREF_DBTIME 指向由小时、分钟和秒组成的时间结构的指针。该数值为 16518。
DT_BYREF_DBTIMESTAMP 指向由年、月、日、小时、分钟、秒和小数秒组成的时间戳结构的指针。小数秒的最大小数位数为 3。该数值为 16519。
DT_BYREF_DBTIME2 指向由小时、分钟、秒和小数秒组成的时间结构的指针。小数秒的最大小数位数为 7。该数值为 16520。
DT_BYREF_DBTIMESTAMPOFFSET 指向由年、月、日、小时、分钟、秒和小数秒组成的时间戳结构的指针。小数秒的最大小数位数为 7。

The DT_DBTIMESTAMPOFFSET data type also has a time zone offset. This offset specifies the number of hours and minutes that the time is offset from the Coordinated Universal Time (UTC). The time zone offset is used by the system to obtain the local time.

The numeric value is 16521.

DT_BYREF_DBTIMESTAMP2 指向由年、月、日、小时、分钟、秒和小数秒组成的时间戳结构的指针。小数秒的最大小数位数为 7。该数值为 16522。

注释

Data types are divided into reference types and value types. Reference types point to an object of the specified type. Value types contain the actual data, not a pointer to the data.

For those data types that are value types, there are times where you need a pointer to their data, not the data itself. In the member table, the DT_BYREF* members are fields that were created to be pointers to value types.

For more information, see 在数据流中使用数据类型.

注意注意

Boolean values are logical values, not numbers. Although Boolean values may be displayed as numbers in some environments, they are not stored as numbers, and various programming languages represent Boolean values as numeric values differently, as do the .NET Framework methods.

For example, the conversion functions available in Visual Basic convert True to -1; however, the System.Convert.ToInt32 method in the .NET Framework converts True to +1. The Integration Services Expression Language converts True to -1.

To avoid errors or unexpected results, you should not write code that relies on particular numeric values for True and False. Wherever possible, you should restrict usage of Boolean variables to the logical values for which they are designed.

For more information about data types, see Integration Services 数据类型.