Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql

Status
Not open for further replies.

fmardani

Programmer
Jul 24, 2003
152
The following query wworks fine.
It runs a dts package with the necessary parameters.

exec master..xp_cmdshell 'dtsrun /S UKSTMATD07 /E /N DTS_SendEmail /A Subject:8=ERROR /A SendTo:8=test@hotmail.com /A Body:8=d
BUT this one does not work because I am using a variable. The error message is: incorrect syntax near +

declare @email varchar(1000)
set @email = 'test@hotmail.com'

exec master..xp_cmdshell 'dtsrun /S UKSTMATD07 /E /N DTS_SendEmail /A Subject:8=ERROR /A SendTo:8=' + @email + ' /A Body:8=d
Do you know why
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top