Using variables within the expression field on a Derived Column task

  • I am importing data from Excel into SQL. I created new columns with the derived column task

    The journal ID column has this format OFFICEUTILALLOC[mm][yy]

    So for June 2008 the journal ID is OFFICEUTILALLOC0608

    I have created two variables Month and Year

    I have two questions, when I add the variables I simply click the blue x and say 'Month' nowhere do I see where you indicate the format of this variable

    Second question how can I use my variables in the expressions field to create my journal ID?

  • Your expression is fairly simple:

    "OFFICEUTILALLOC" + RIGHT("00"+(DT_WSTR,2) @[User::Month],2) + RIGHT("00"+(DT_WSTR,2) @[User::Year],2)

    As far as the format of a variable - variables don't have a format, they have a data type. Yours are probably supposed to be INT and that is the default, but in the variables window you can set the format or while clicked on a variable in the variables window the properties for the variable will appear in the properties window.

    Make sure you are clicked on the correct object in your SSIS package when you create a variable. What you are clicked on determines the variable scope and that will have a big impact.

  • Thanks Michael when I hit submit I found how to get to the variable properties....

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

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