Working with Data Types in the Data Flow
When developing a custom data flow component in Integration Services, you work constantly with data types, copying data into and out of data flow buffers and transforming values. The information in this topic helps you to choose the correct Integration Services data types, and to use the correct methods when working with them.
Inserting Data into the Data Flow
The PipelineBuffer class provides a series of Set methods for copying data into buffer columns, and a corresponding series of Get methods for retrieving data from buffer columns. The following tables show you which method to use with each Integration Services data type.
Set Methods to use with Data Types
The following table lists the data type in the first column, and then lists the corresponding Set and Get methods.
Data Type |
Set Method |
Get Method |
---|---|---|
There is no Get method that is applicable to this data type. |
||
Data Types to Use with the Set Methods
Set Method |
Data Type |
---|---|
DT_CY, DT_DECIMAL, or DT_NUMERIC |
|
Mapping Data Types in the Data Flow
While moving data from sources through transformations to destinations, a data flow component must sometimes convert data types between the SQL Server Integration Services types defined in the DataType enumeration and the managed data types of the Microsoft .NET Framework defined in the System namespace. In addition, a component must sometimes convert one Integration Services data type to another before that type can be converted to a managed type.
Note
The mapping files in XML format that are installed by default to C:\Program Files\Microsoft SQL Server\110\DTS\MappingFiles are not related to the data type mapping discussed in this topic. These files map data types from one database version or system to another (for example, from SQL Server to Oracle), and are used only by the SQL Server Import and Export Wizard. For more information on these mapping files, see SQL Server Import and Export Wizard.
Mapping between Integration Services and Managed Data Types
The PipelineComponent.BufferTypeToDataRecordType and the PipelineComponent.DataRecordTypeToBufferType methods map Integration Services data types to managed data types.
Warning
Developers should use these methods of the PipelineComponent class with caution, and may want to code data type mapping methods of their own that are more suited to the unique needs of their custom components. The existing methods do not consider numeric precision or scale, or other properties closely related to the data type itself. Microsoft may modify or remove these methods, or modify the mappings that they perform, in a future version of Integration Services.
The following table lists how the BufferTypeToDataRecordType and the DataRecordTypeToBufferType methods map various Integration Services data types to managed data types.
Integration Services Data Type |
Maps to this Managed Data Type |
---|---|
System.String |
|
Array of System.Byte |
|
System.DateTime |
|
System.DateTime |
|
System.DateTimeOffset |
|
System.DateTime |
|
System.TimeSpan |
|
System.TimeSpan |
|
System.DateTime |
|
System.DateTime |
|
System.Decimal |
|
System.Guid |
|
System.SByte |
|
System.Int16 |
|
System.Int32 |
|
System.Int64 |
|
System.Boolean |
|
System.Single |
|
System.Double |
|
System.Byte |
|
System.UInt16 |
|
System.UInt32 |
|
System.UInt64 |
Mapping Integration Services Data Types to Fit Managed Data Types
Sometimes a data flow component must also convert one Integration Services data type to another before that type can be converted to a managed type. The PipelineComponent.ConvertBufferDataTypeToFitManaged method class maps Integration Services data types to other Integration Services data types that can then be mapped to managed data types by using the PipelineComponent.BufferTypeToDataRecordType method.
Warning
Developers should use these methods of the PipelineComponent class with caution, and may want to code data type mapping methods of their own that are more suited to the unique needs of their custom components. The existing methods do not consider numeric precision or scale, or other properties closely related to the data type itself. Microsoft may modify or remove these methods, or modify the mappings that they perform, in a future version of Integration Services.
The following table lists how the ConvertBufferDataTypeToFitManaged method maps Integration Services data types to other Integration Services data types.
Original Integration Services Data Type |
Maps to this Integration Services Data Type |
---|---|
Note
The ConvertBufferDataTypeToFitManaged method does not return a value for the DT_DBTIMESTAMPOFFSET data type, and a UnsupportedBufferDataTypeException occurs. You must convert the DT_DBTIMESTAMPOFFSET data type to one of the Integration Services date/time data types that can be mapped to a managed data type. For a list of Integration Services date/time data types that can be mapped to a managed data types, see the table in the previous section, "Mapping between Integration Services and Managed Data Types." For information about converting data types, see Integration Services Data Types.
|
See Also
Reference
ConvertBufferDataTypeToFitManaged