SSIS - Multiple variables in email subject line

  • Hi, I've found some really fantastic tutorials on this site and all over the web that have helped me create an "Execute SQL Task" in SSIS. The task runs a select query and saves the results to four variables.

    A "Script Task" outputs the values to a message box so I can confirm that they are being stored properly.

    The last piece of my effort is to output these four variables as a dynamic subject line in an email message. To do this, I have set up a subject expression in a "Send Mail Task" that looks like this:

    (DT_WSTR, 40) @[User::Date] + " - 1:" + (DT_WSTR, 40) @[User::Variable1] + " 2:" + (DT_WSTR, 40) @[User::Variable2] + " 3:" + (DT_WSTR, 40) @[User::Variable3]

    Unfortunately, only the date and Variable1 are displayed properly in the email subject line. Variable2 and Variable3 are always displayed as 0.

    5/22/2010 - 1:173857 2:0 3:0

    Has anyone run across a problem like this?

  • The problem was in all my trial and error, I had defined variables 2 and 3 twice. For some reason the msgbox was reading the second ones but the email task was reading the first ones.

    Deleted the first ones and all is well.

    EDIT: The msgbox was reading the second ones because those were the ones I checked as ReadOnlyVariables when setting up the "Script Task".

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

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