December 12, 2008 at 12:47 pm
Hi experts, I use dbmail frequently but this time I want to send mail to whomever is designated as one of my SQL Server Agent operators specifically the operator named 'SQL Server Agent Operator'. What do I specify as the @Recipients=?
Thank you.
December 12, 2008 at 2:06 pm
You can use sp_notify_operator:
sp_notify_operator
[ @profile_name = ] 'profilename' ,
[ @id = ] id ,
[ @name = ] 'name' ,
[ @subject = ] 'subject' ,
[ @body = ] 'message' ,
[ @file_attachments = ] 'attachment'
[ @mail_database = ] 'mail_host_database'
Or, you can set a variable and get the value from msdb.dbo.sysoperators:
Declare @emailAddress nvarchar(100);
Set @emailAddress = (Select s.email_address
From msdb.dbo.sysoperators s
Where name = 'MyName');
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
December 12, 2008 at 2:11 pm
Thank you Jeffery. I will keep both methods on hand. For simplicity I think I try the second method first. Warm regards, Hope
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply