Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SSIS Send Mail, trying to use user variable for file name, but SSIS is using default value, not reset value

Posted on 2010-08-24
4
Medium Priority
?
856 Views
Last Modified: 2013-11-10
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
@[User::VariableName]
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?
0
Comment
Question by:Scott Pletcher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Reza Rad earned 750 total points
ID: 33518453
maybe sql step doesn't work correctly all times,
why you don't set this variable with expression?
just right click on variable, go to properties window, set expression as you want, and also set EvaluateAsExpression property to true
0
 
LVL 21

Assisted Solution

by:Jason Yousef, MS
Jason Yousef, MS earned 750 total points
ID: 33619803
I wanna help but can't get an idea of the how do you populate the VAR, can you post a screen shot of your package along with the variable configuration?
0
 
LVL 70

Author Comment

by:Scott Pletcher
ID: 33621002
This is now working.  It looks like SQL does not display the correct value when running/debugging the script, but that the value does get set when a job runs the package.

I didn't see some of the resulting emails because of the spam filter.  For some reason it was trapping the emails, thus i didn't see them.
0
 
LVL 70

Author Closing Comment

by:Scott Pletcher
ID: 33621020
Sorry, this turned out to be a different issue than what I thought I would be.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question