Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Sending mail on a TRIGGER stops insert from taking place (and email doesnt send)
  2. ALTER TRIGGER [dbo].[SendErrorEmail]
  3.    ON  [dbo].[tblNewErrorLog]
  4.    FOR INSERT
  5. AS
  6. BEGIN  
  7.  
  8.  
  9.     EXEC msdb.dbo.sp_send_dbmail
  10.         @profile_name='myprofile',
  11.         @recipients='me@me.com',
  12.         @subject='error in the database',
  13.         @body = 'check it out'
  14.  
  15. END