Avatar of JRuiter
JRuiter
 asked on

SQL Integraton Services 2005 SMTP email - how do I put a variable in the subject line

I have a 2005 SSIS package that sends email based upon the value of a database field.  The package runs to completion.  I would like to construct a Subject field based upon some variables.

For Example:

Subject:  @CustomerID, @OrderID

where @CustomerID and @OrderID are variables.

I don't see a way to construct a subject line.  Is it possible?

Thanks
Microsoft SQL ServerMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
jawaharroy

8/22/2022 - Mon
pateljitu

Please try code as provided:

DECLARE @emailSubject varchar(250)
SET @emailSubject = '' + convert(varchar(10), @CustomerID) +',  '+  convert(varchar(10), @OrderID) +''
JRuiter

ASKER
Where do I put that code? Do I create an expression?

I don't see anywhere in the Subject line that it will accept input from SQL code or a variable, unlike the message body - I can use an expression there.
pateljitu

would you be able to provide sample or reference of your code.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
jawaharroy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question