- Sending mail on a TRIGGER stops insert from taking place (and email doesnt send)
- ALTER TRIGGER [dbo].[SendErrorEmail]
- ON [dbo].[tblNewErrorLog]
- FOR INSERT
- AS
- BEGIN
- EXEC msdb.dbo.sp_send_dbmail
- @profile_name='myprofile',
- @recipients='me@me.com',
- @subject='error in the database',
- @body = 'check it out'
- END