September 13, 2010 at 5:48 am
Dear friends
long time since visiting.. but please could you help me today..!
I am using sp_send_dbmail :
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'SQLMail Profile',
@recipients = 'richard.briggs@leansoftware.net', @copy_recipients = '',
@importance = 'High', @subject = 'Email Subject',
@body = 'Email Body....hi this is test email', @body_format = 'HTML' ;
However rather than specifying email address I want to secify an SQL Operator.
I have had a trawl trying to find out where to get list of defined Operators from .. but no luck yet .. can anyone guide me?
Many thanks
C# Gnu
____________________________________________________
September 13, 2010 at 6:21 am
declare @oper_email nvarchar(100)
set @oper_email = (select email_address from msdb.dbo.sysoperators)
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'SQLMail Profile',
@recipients = @oper_email, @copy_recipients = '',
@importance = 'High', @subject = 'Email Subject',
@body = 'Email Body....hi this is test email', @body_format = 'HTML' ;
-- if you have multiple operators, this WILL NOT WORK...
September 13, 2010 at 6:31 am
Oh thats great thanks Geoff.
I know the name of the operator so I can filter on name ='bla'.
BTW I have my operator defined with multiple email addresses 'someone@leansoftware.net;someone_else@leansoftware.net'
I suppose I should create an NT Group and specify that as the email address, mind you the above list approach seems to work ok for me in sql 2008.
Thanks again!
C# Gnu
____________________________________________________
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply