In SSIS, I'm trying to have a dynamic file name for a mail attachment. I have to include date and time in the file name.
I created a package level variable, set it to a default value (I'm forced to, since that variable is used as source and SQL pre-checks package values), and used a SQL step to set the package-level variable with the file name I need.
I can use that variable to rename the generic file to my generated file name with the specific date time, so I know that variable's getting properly set (although I don't see the new value in the variable in SSIS debug mode).
My last task is an email step to email the file. I have set the FileAttachments expression to
for that task.
But often the email doesn't work, and when it does, it sends the dummy name that the variable had on entry to the package rather than the generated value I reset the variable to in my SQL step.
What do I need to get the email task to use the *current* variable value to attach the file?