Saturday, February 25, 2012

Custom Component - Change Data Type

I am developing a custom pipeline component (my first real one) which will handle input columns in a DT_NUMERIC format and convert them to a DT_DATE format. Sort of like the included Data Conversion component, but with some built in business logic. The Data Conversion component puts the converted data in a new column in the output buffer. I would like to keep the data in the same column. So, in my input buffer the column would be of type DT_NUMERIC, but in the output buffer I want to make it DT_DATE.

What is the best approach to do this?

-DarrellUnless you want you component to have to copy data from the input to the ouput you can not do this. There are 2 types of outputs, synchronous and asynchronous. The synchronous one is simple and requires no data copying or column creation (except of course for the new column you would produce of the DT_DATE type). However, because of this you can't change column types and that is why the derived column doesn't allow this. The asynchronous one is complex. You have to create all the output columns and keep them in sync with the input columns and know how to map the input columns to the output columns so that you can copy the data to the correct place. My advise is use a sync output and live with the additional column unless it is absolutely necessary to use and async output.

HTH,
Matt

No comments:

Post a Comment