blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

SSIS Junkie

Conchango are busy and need talented consultants in and around London. Interested? Email me or send me a message

SSIS: PipelineBuffer.Set*() methods

If you are building asynchronous custom components for SSIS then at some point you will need to use the various Set*() methods of the PipelineBuffer class to populate data into the output buffer. There are a lot of these set methods but the documentation is pretty lax about which you should use depending on the DataType of the column that you are populating. Hence, I thought I'd try and provide a definitive mapping list.

DataTypeSet method
DT_BOOLSetBoolean()
DT_BYTESSetBytes()
DT_CYSetDecimal()
DT_DATESetDateTime()
DT_DBTIMESTAMPSetDateTime()
DT_DECIMALSetDecimal()
DT_GUIDSetGuid()
DT_I1SetSByte()
DT_I2SetInt16()
DT_I4SetInt32()
DT_I8SetInt64()
DT_IMAGEAddBlobData()
DT_NTEXTAddBlobData()
DT_NULLSetNull()
DT_NUMERICSetDecimal()
DT_R4SetSingle()
DT_R8SetDouble()
DT_STRSetString()
DT_TEXTAddBlobData()
DT_UI1SetByte()
DT_UI2SetUInt16()
DT_UI4SetUInt32()
DT_UI8SetUInt64()
DT_WSTRSetString()

 

 Here is the same information presented slightly differently so you can see which methods are used for more than one datatype.

Set methodDataType
SetBoolean()DT_BOOL
SetBytes()DT_BYTES
SetDecimal()DT_CY, DT_NUMERIC, DT_DECIMAL
SetDateTime()DT_DATE, DT_DBTIMESTAMP
SetGuid()DT_GUID
SetSByte()DT_I1
SetInt16()DT_I2
SetInt32()DT_I4
SetInt64()DT_I8
AddBlobData()DT_IMAGE, DT_NTEXT, DT_TEXT
SetNull()DT_NULL
SetSingle()DT_R4
SetDouble()DT_R8
SetString()DT_STR, DT_WSTR
SetByte()DT_UI1
SetUInt16()DT_UI2
SetUInt32()DT_UI4
SetUInt64()DT_UI8

 

[Note that when I authored this blog entry in Live Writer all the gridlines in the above tables were visible. Someone has configured our blog server not to display them. I know not why, answers on a postcard!] 

Note also that SetNull() can be used on any non-BLOB columns to insert a null value. The BLOB datatypes are DT_TEXT, DT_NTEXT and DT_IMAGE.

The eagle-eyed amongst you will notice that some data types are not covered in the above list; DT_DBTIME, DT_DBDATE and DT_FILETIME are all missing. The reason is that there are no Set*() methods that support those types. For DT_DBDATE and DT_FILETIME however you can simply set the column to an object that is of the correct type (i.e. DateTime). The object is internally cast to the correct type however be aware that you must pass the correct type (of course) hence this is NOT type safe. For DT_DBTIME the story gets even worse in SSIS2005, there is simply no support at all for populating DT_DBTIME columns from managed code. I'm reliably informed that there is a new SetTime() method in SSIS2008 that will support this.

If I can be bothered to piece together some sample code from my inelegant efforts I might post it up here soon. Watch this space.

 

Thanks to Michael Entin for all his help in furnishing me with the information for this blog entry.

-Jamie

Published 05 September 2007 08:31 by jamie.thomson

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

SSIS Junkie said:

Careful Sydney! There's some C# code in Jamie's latest blog post :) Yesterday I posted this blog post

September 6, 2007 05:00

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

News

Powered by Community Server (Personal Edition), by Telligent Systems