Professional Documents
Culture Documents
Type Data Konversi
Type Data Konversi
Type Data Konversi
When data enters a data flow in a package, the source that extracts the data converts the data to
an Integration Services data type. Numeric data is assigned a numeric data type, string data is
assigned a character data type, and dates are assigned a date data type. Other data, such as
GUIDs and Binary Large Object Blocks (BLOBs), are also assigned appropriate Integration
Services data types. If data has a data type that is not convertible to an Integration Services data
type, an error occurs.
Some data flow components convert data types between the Integration Services data types and
the managed data types of the Microsoft .NET Framework. For more information about the
mapping between Integration Services and managed data types, see Working with Data Types in
the Data Flow.
The following table lists the Integration Services data types. Some of the data types in the table
have precision and scale information that applies to them. For more information about precision
and scale, see Precision, Scale, and Length (Transact-SQL).
If the sign of the hour offset is negative, the minute offset must
be negative or zero.
If the sign for the hour offset is positive, the minute offset must
be positive or zero.
If the sign for the hour offset is zero, the minute offset can be
any value from negative 0.59 to positive 0.59.
An exact numeric value with a fixed precision and a fixed scale.
DT_DECIMAL This data type is a 12-byte unsigned integer with a separate
sign, a scale of 0 to 28, and a maximum precision of 29.
A 64-bit value that represents the number of 100-nanosecond
DT_FILETIME intervals since January 1, 1601. The fractional seconds have a
maximum scale of 3 digits.
DT_GUID A globally unique identifier (GUID).
DT_I1 A one-byte, signed integer.
DT_I2 A two-byte, signed integer.
Data type Description
DT_I4 A four-byte, signed integer.
DT_I8 An eight-byte, signed integer.
An exact numeric value with a fixed precision and scale. This
DT_NUMERIC data type is a 16-byte unsigned integer with a separate sign, a
scale of 0 - 38, and a maximum precision of 38.
DT_R4 A single-precision floating-point value.
DT_R8 A double-precision floating-point value.
A null-terminated ANSI/MBCS character string with a
maximum length of 8000 characters. (If a column value
DT_STR
contains additional null terminators, the string will be truncated
at the occurrence of the first null.)
DT_UI1 A one-byte, unsigned integer.
DT_UI2 A two-byte, unsigned integer.
DT_UI4 A four-byte, unsigned integer.
DT_UI8 An eight-byte, unsigned integer.
A null-terminated Unicode character string with a maximum
length of 4000 characters. (If a column value contains
DT_WSTR
additional null terminators, the string will be truncated at the
occurrence of the first null.)
A binary value with a maximum size of 2^31-1 (2,147,483,647)
DT_IMAGE
bytes. .
A Unicode character string with a maximum length of 2^30 - 1
DT_NTEXT
(1,073,741,823) characters.
An ANSI/MBCS character string with a maximum length of
DT_TEXT
2^31-1 (2,147,483,647) characters.
Integration Services includes a complete set of numeric data types, so that you can match the
data type closely to the size of the data. For example, if the values in a column with a DT_UI8
data type are always integers between 0 and 3000, you can change the data type to DT_UI2.
Similarly, if a column with the DT_CY data type can meet the package data requirements by
using an integer data type instead, you can change the data type to DT_I4.
You can change the data type of a column in the following ways:
Use an expression to implicitly convert data types. For more information, see Integration
Services Data Types in Expressions, Integration Services Data Types in Expressions, and
Integration Services (SSIS) Expressions.
Use the cast operator to convert data types. For more information, see Cast (SSIS
Expression).
Use the Data Conversion transformation to cast the data type of a column from one data
type to a different data type. For more information, see Data Conversion Transformation.
Use the Derived Column transformation to create a copy of a column that has a different
data type than the original column. For more information, see Derived Column
Transformation.
The following table lists the results of casting or converting between date/time data types and
strings:
When you use the cast operator or the Data Conversion transformation, the date or time
type data type will be converted to the corresponding string format. For example, the
DT_DBTIME data type will be converted to a string that has the format, "hh:mm:ss".
When you want to convert from a string to a date or time data type, the string must use
the string format that corresponds to the appropriate date or time data type. For example,
to successfully convert some date strings to the DT_DBDATE data type, these date
strings must be in the format, "yyyy-mm-dd".
In the format for DT_FILETIME and DT_DBTIMESTAMP fff is a value between 0 and
999 that represents fractional seconds.
In the date format for DT_DBTIMESTAMP2, DT_DBTIME2, and
DT_DBTIMESTAMPOFFSET, fffffff is a value between 0 and 9999999 that represents
fractional seconds.
The date format for DT_DBTIMESTAMPOFFSET also includes a time zone element.
There is a space between the time element and the time zone element.
Convert
Result
DT_DBTIMESTAMP to
DT_FILETIME Converts the data type.
If a value represented by the DT_DBTIMESTAMP data type
overflows the range of the DT_DATE data type, returns the
DT_DATE
DB_E_DATAOVERFLOW error. For more information, see
Error Handling in Data.
Removes the time value represented by the
DT_DBDATE
DT_DBTIMESTAMP data type.
Removes the date value represented by the
DT_DBTIMESTAMP data type.
Convert
Result
DT_DBTIMESTAMP2 to
Removes the fractional second value when its scale is greater
than the number of fractional second digits that the
DT_FILETIME DT_FILETIME data type can contain. After removing the
fractional second value, generates a report about this data
truncation. For more information, see Error Handling in Data.
If a value represented by the DT_DBTIMESTAMP2 data type
overflows the range of the DT_DATE data type, the
DB_E_DATAOVERFLOW error is returned. For more
information, see Error Handling in Data.
DT_DATE
Removes the fractional second value when its scale is greater
than the number of fractional second digits that the DT_DATE
data type can contain. After removing the fractional second
value, generates a report about this data truncation. For more
information, see Error Handling in Data.
Convert
Result
DT_DBTIMESTAMP2 to
Removes the time value represented by the
DT_DBDATE
DT_DBTIMESTAMP2 data type.
Removes the date value represented by the
DT_DBTIMESTAMP2 data type.
Convert
DT_DBTIMESTAMPOFFSET Result
to
Changes the time value represented by the
DT_DBTIMESTAMPOFFSET data type to Coordinated
Universal Time (UTC).
DT_DBTIMESTAMP2 Removes the fractional second value when its scale is greater
than the number of fractional second digits that the
DT_DBTIMESTAMP2 data type can contain. After
removing the fractional second value, generates a report
Convert
DT_DBTIMESTAMPOFFSET Result
to
about this data truncation. For more information, see Error
Handling in Data.
Removes the fractional second value when its scale is greater
than the number of fractional second digits that the
destination DT_DBTIMESTAMPOFFSET data type can
DT_DBTIMESTAMPOFFSET
contain. After removing the fractional second value,
generates a report about this data truncation. For more
information, see Error Handling in Data.
Important
These mappings are not intended to represent strict equivalency, but only to provide guidance. In
certain situations, you may need to use a different data type than the one shown in this table.
Note
You can use the SQL Server data types to estimate the size of corresponding Integration Services
date and time data types.
SQL
Server
Oracle DB2 DB2
SQL
Data Type (SQLOLE Server Jet
(OracleClie (DB2OLE (IBMDAD
DB; (SqlClient)
nt) DB) B2)
SQLNCLI
10)
DT_BOOL bit bit Bit
BigBina
binary, binary,
ry,
DT_BYTES varbinary, varbinary, RAW
VarBina
timestamp timestamp
ry
smallmone smallmone Currenc
DT_CY
y, money y, money y
SQL
Server
Oracle DB2 DB2
SQL
Data Type (SQLOLE Server Jet
(OracleClie (DB2OLE (IBMDAD
DB; (SqlClient)
nt) DB) B2)
SQLNCLI
10)
DT_DATE
date date
DT_DBDATE (Transact- (Transact- date date date
SQL) SQL)
DT_DBTIME timestamp time time
time time
DT_DBTIME2 (Transact- (Transact-
SQL)(p) SQL) (p)
datetime datetime
(Transact- (Transact-
SQL), SQL), TIMESTA TIME, TIME,
DateTim
DT_DBTIMESTAMP smalldateti smalldateti MP, DATE, TIMESTA TIMESTA
e
me me INTERVAL MP, DATE MP, DATE
(Transact- (Transact-
SQL) SQL)
datetime2 datetime2
DT_DBTIMESTAMP
(Transact- (Transact- timestamp timestamp timestamp
2
SQL) SQL)
datetimeoff datetimeoff
timestamp, timestamp,
DT_DBTIMESTAMP set set timestampof
OFFSET (Transact- (Transact- fset
varchar varchar
SQL)(p) SQL) (p)
DT_DECIMAL
DT_FILETIME
uniqueident uniqueident
DT_GUID GUID
ifier ifier
DT_I1
SMALLIN SMALLIN
DT_I2 smallint smallint Short
T T
DT_I4 int int Long INTEGER INTEGER
DT_I8 bigint bigint BIGINT BIGINT
decimal, decimal, NUMBER, DECIMAL, DECIMAL,
DT_NUMERIC Decimal
numeric numeric INT NUMERIC NUMERIC
DT_R4 real real Single REAL REAL
SQL
Server
Oracle DB2 DB2
SQL
Data Type (SQLOLE Server Jet
(OracleClie (DB2OLE (IBMDAD
DB; (SqlClient)
nt) DB) B2)
SQLNCLI
10)
FLOAT, FLOAT, FLOAT,
DT_R8 float float Double
REAL DOUBLE DOUBLE
CHAR, CHAR,
char,
DT_STR VarChar VARCHA VARCHA
varchar
R R
DT_UI1 tinyint tinyint Byte
DT_UI2
DT_UI4
DT_UI8
CHAR,
char,
ROWID,
nchar, varchar,
VARCHAR GRAPHIC, GRAPHIC,
nvarchar, nchar, LongTe
DT_WSTR 2, VARGRAP VARGRAP
sql_variant, nvarchar, xt
NVARCHA HIC HIC
xml sql_variant,
R2,
xml
NCHAR
LONG
RAW,
CHAR ()
BLOB,
CHAR () FOR BIT
LOBLOCA
FOR BIT DATA,
TOR,
LongBin DATA, VARCHA
DT_IMAGE image image BFILE,
ary VARCHA R () FOR
VARGRAP
R () FOR BIT
HIC, LONG
BIT DATA DATA,
VARGRAP
BLOB
HIC, user-
defined
LONG
LONG
LONG, VARCHA
VARCHA
CLOB, R,
R,
DT_NTEXT ntext text, ntext NCLOB, DBCLOB,
NCHAR,
NVARCHA NCHAR,
NVARCH
R, TEXT NVARCH
AR, TEXT
AR, TEXT
LONG
LONG
DT_TEXT text VARCHA
VARCHA
R FOR BIT
SQL
Server
Oracle DB2 DB2
SQL
Data Type (SQLOLE Server Jet
(OracleClie (DB2OLE (IBMDAD
DB; (SqlClient)
nt) DB) B2)
SQLNCLI
10)
R FOR BIT DATA,
DATA CLOB