I am trying to figure out how to add a time datestamp to my xp_sendmail procedure:
use master;
go
CREATE PROC pr_sendmail
AS
DECLARE @.DT DATETIME
SET @.DT=GETDATE()
BEGIN
EXEC xp_sendmail @.recipients = 'me@.work.com',
@.message = 'send email from SQL Server Stored Procedure.',
@.copy_recipients = 'me@.work.com',
@.subject = 'Job Started at ', @.DT
END
How do I get this to work? Thanks!@.subject = 'Job Started at ' + cast(getdate() as varchar)
you can also use CONVERT instead of CAST to format the date in various different formats.
Showing posts with label pr_sendmail. Show all posts
Showing posts with label pr_sendmail. Show all posts
Sunday, February 19, 2012
Subscribe to:
Posts (Atom)