February 4, 2014 at 3:09 am
Hi everyone,
I have some trouble with the sp_send_dbmail procedure.
I use the following code :
declare @Body varchar(500)
set @body = 'my text for server ' + @@servername
exec msdb..sp_send_dbmail
@subject = 'my_subject' ,
@recipients = 'my_email_adresse',
@query = @Body ,
@profile_name = 'my_profile'
But I have the following error :
Msg 22050, Level 16, State 1, Line 0
Error formatting query, probably invalid parameters
Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 504
Query execution failed: Msg 156, Level 15, State 1, Server [SERVERNAME], Line 1
Incorrect syntax near the keyword 'for'.
Do you know what I do wrong ?!
Thanks in advance !
February 13, 2014 at 4:58 am
DECLARE @MailBody VARCHAR(500)
SELECT @MailBody = 'My text for server ' + @@SERVERNAME
EXEC MSDB..SP_Send_DBMail
@Subject = 'my_subject',
@Recipients = 'my_email_adresse',
@Body = @MailBody,
@Profile_name = 'my_profile'
February 14, 2014 at 8:33 am
many thanks 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply