February 11, 2013 at 11:32 am
I have to set up a sql job that sends an email
suppose
"This is to test that today is 02/11/2013 and it is a good day"
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'someone@yahoo.com,
@subject = 'Test',
@body =
'This is to test that today is 02/11/2013 and it is a good day'
Is there any way that whenever the job runs it puts the current date with
"SELECT CONVERT(VARCHAR(12),GETDATE(), 101)"
February 11, 2013 at 11:46 am
Unfortunately, SQL Server doesn't like to have concatenated stuff passed to parameters. So, you could do something like this:
declare @strBody varchar(255);
select @strBody = 'This is to test that today is ' + CONVERT(VARCHAR(12), GETDATE(), 101) + ' and it is a good day';
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'someone@yahoo.com',
@subject = 'Test',
@body = @strBody;
February 13, 2013 at 7:28 am
Ed Wagner (2/11/2013)
Unfortunately, SQL Server doesn't like to have concatenated stuff passed to parameters. So, you could do something like this:
declare @strBody varchar(255);
select @strBody = 'This is to test that today is ' + CONVERT(VARCHAR(12), GETDATE(), 101) + ' and it is a good day';
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'someone@yahoo.com',
@subject = 'Test',
@body = @strBody;
That was good. Thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply