Help with query: I currently cannot be alerted by SQL Mail so I would like to take the script that was generated by SQL server and using the store procedure sp_sqlsmtpmail to generate a email using smtp server to alert me. The store procedure does work. I would like to know if this is possible.
Thanks
Lystra
-- Script generated on 1/21/2005 10:04 AM
-- By: MAMSI\sa
-- Server: (local)
IF (EXISTS (SELECT name FROM msdb.dbo.sysalerts WHERE name = N'Demo: Full tempdb'))
-- Delete the alert with the same name.
EXECUTE msdb.dbo.sp_delete_alert @.name = N'Demo: Full tempdb'
BEGIN
EXECUTE msdb.dbo.sp_add_alert @.name = N'Demo: Full tempdb', @.message_id = 9002, @.severity = 0, @.enabled = 1, @.delay_between_responses = 10, @.include_event_description_in = 5, @.database_name = N'tempdb', @.category_name = N'[Uncategorized]'
Then
Exec sp_sqlsmtpmail
@.vcTo = 'lwilliams@.Huc.com',
@.vcBody ='Check out problem Immediataly.',
@.vcSubject ='DOCSITE01FDK - Full Tempdb Log'
ENDYou can have the alert execute a job that has the call to sp_sqlsmtpmail in one of it's steps.|||Great idea, thanks.
Lystra
Sunday, February 19, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment