Solved

SSIS: Using User variables in Send Mail Task

Posted on 2013-12-06
3
2,006 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server Insert where not exists 24 42
Creating an SSIS surrogate key pipeline 6 26
SSIS with VPN COnnection 2 77
MS SQL + Insert Into Table - If Doesnt Exist 9 36
Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 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