Solved

SSIS: Using User variables in Send Mail Task

Posted on 2013-12-06
3
1,924 Views
Last Modified: 2016-02-10
Hi there,

I am trying to build an email message using Send Mail task but taking some of the message in the email from two user defined variables that I have set in Execute SQL Task (i.e. configuring Result Set to relate my user defined variables to the column names where I'm reading the values from).

The expression I've tried to build in the Send Mail task is below:

"The xxxx xxxxxx report was successfully processed with an open date of: " + @[User::FileDate2] + "and an open time of: " + @[User::FileTime2]

Open in new window


But I get the error is

"The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created."

However, it seems to work if I just select the user variable i.e. if I just choose User::FileDate2 then I get the value I'm looking for but obviously no messages around what it means just a date.

What can I do to get the email message I'm looking for?

Thanks,

Segun
0
Comment
Question by:onesegun
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39700933
Try putting the body of the message into its own variable, which will allow you to include other variables as part of its definition. Then use that to populate your mail task.
0
 
LVL 37

Expert Comment

by:ValentinoV
ID: 39713507
Are you sure both variables are on package-level scope?  You can check that from the Variables window where one of the columns mentions the scope.
0
 

Author Closing Comment

by:onesegun
ID: 39714007
Seems like the only way is to join the variables together at the script task level i.e. the message, the time variable and the date variable into one long variable and then use that in the Send Mail Task.

Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
My client sends data in an Excel file to me to load them into Staging database. The file contains many sheets that they have same structure. In this article, I would like to share the simple way to load data of multiple sheets by using SSIS.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now