?
Solved

Concatenation of a String to a declared variable

Posted on 2003-03-06
6
Medium Priority
?
927 Views
Last Modified: 2012-08-13
I am trying the following code:

EXEC master..xp_sendmail
     @recipients =  @Email,
     @subject = 'Your Coupon has been Accepted',
     @message = 'Your Profile has been updated with the Coupon ID# ' + @CouponNum

Where @CouponNum is the variable I am trying to make dynamic but I keep getting an error about the plus sign. So how do I assign a variable using string + variable concatenation
0
Comment
Question by:DrDre
[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
6 Comments
 
LVL 4

Expert Comment

by:CRagsdell
ID: 8086225
Try & instead of +

CR
0
 

Author Comment

by:DrDre
ID: 8086238
Tried & still getting a syntax error
0
 
LVL 13

Accepted Solution

by:
ispaleny earned 300 total points
ID: 8086317
declare @message varchar(200)
set     @message = 'Your Profile has been updated with the Coupon ID# ' + @CouponNum
EXEC master..xp_sendmail
    @recipients =  @Email,
    @subject = 'Your Coupon has been Accepted',
    @message = @message
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:DrDre
ID: 8086342
Thank you, it work like a charm
0
 
LVL 9

Expert Comment

by:Nitin Sontakke
ID: 8086524
If you are happy with ispaleny's comment, please accept them as answer and close this thread.
0
 
LVL 13

Expert Comment

by:ispaleny
ID: 8090694
Here to help. Thanks.
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

770 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