Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql agent operators

Author  Topic 

kneekill
Yak Posting Veteran

76 Posts

Posted - 2009-04-07 : 16:28:57
Hi

i need to send mail to specific operator created under sql agent using sp_send_dbmail procedure ,after going trough some articles on net i found we can only send mail to specific email address in @recipient parameter of the procedure. not as below with operator name

exec sp_send_dbmail @Recipient= Operator ,@Subject='something ',@body ='send mail to Operator'

Is there a way in which we can query on the operator to get the mail address inside it so we could send mail to the obtained email address from the operator?


is the operator data stored in any specific system table of sql server 2005


please guide...or suggest alternative to send mail to an operator from a stored procedure..

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-04-07 : 18:28:12
To find this (if you haev priviledges)
1. Right click on Operator and select CREATE to New Query
2. You see that it calls msdb.dbo.sp_add_operator
3. Look at msdb.dbo.sp_add_operator in msdb , Right Click and say Modify. You see it does
INSERT INTO msdb.dbo.sysoperators
therefore to find operators

SELECT [id]
,[name]
,[enabled]
,[email_address]
,[last_email_date]
,[last_email_time]
,[pager_address]
,[last_pager_date]
,[last_pager_time]
,[weekday_pager_start_time]
,[weekday_pager_end_time]
,[saturday_pager_start_time]
,[saturday_pager_end_time]
,[sunday_pager_start_time]
,[sunday_pager_end_time]
,[pager_days]
,[netsend_address]
,[last_netsend_date]
,[last_netsend_time]
,[category_id]
FROM [msdb].[dbo].[sysoperators]

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

kneekill
Yak Posting Veteran

76 Posts

Posted - 2009-04-08 : 02:59:27
thanks yosiasz, it helped me solve the issue
Go to Top of Page
   

- Advertisement -