add column to output

  • We have about 47 databases that I have to write jobs to pull data for. The one thing they don't have is a way to say, I'm from building1, I'm from building 2, so I thought I would add something in the data conversion that would just fill in a number that corresponds to the building number

    So that when it gets inserted into the database it'll look something like

    47, column1, column2, column3, etc. There's an autoincrementing sequence and an update field that automatically does a getDate() when something is put in.

    Where do I add it? I thought I could add it as part of the Data Flow Source in the select statement:

    select 47, column1, etc. Or select '47', but it's not working.

    Any ideas?

  • Mathew,

    What data access mode are you using when pulling data from your source?

    are you using "Table or View" or "Sql Command" If table or View, then you should be able to add a Derived Column Data Transformation in the data flow task. on Derived column select give it whatever name you want, and on expression put (DT_I2)47

    to make the derived column transformation work you click the daflow and drop it on the transfromation, then take the dataflow from the transformation and drop it on the destination. and that new column will show up and you can map it to the destination column in your destination table.

    If your using "Sql Command" you should be able to add for example

    Select cast(47 as smallint) as BuildingID, Column1, Column2 ...

    and you should be able to see "BuildingID" in your list of columns to map to your destinatino

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply