|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Today @ 9:29 AM
Points: 12,
Visits: 131
|
|
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)"
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 6:44 AM
Points: 1,856,
Visits: 528
|
|
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;
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Today @ 9:29 AM
Points: 12,
Visits: 131
|
|
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
|
|
|
|