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.
Sunday, February 19, 2012
adding date timestamp to xp_sendmail procedure
Labels:
adding,
asdeclare,
database,
date,
datestamp,
datetimeset,
figure,
mastergocreate,
microsoft,
mysql,
oracle,
pr_sendmail,
proc,
procedure,
procedureuse,
server,
sql,
time,
timestamp,
xp_sendmail
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment