Pages

Tuesday, April 8, 2014

Send Email using mysql trigger


CREATE TRIGGER dbo.whatever ON dbo.wherever
FOR INSERT AS BEGIN SET NOCOUNT ON;    

IF EXISTS (SELECT 1 FROM inserted WHERE speed > 100) BEGIN EXEC msdb.dbo.sp_send_dbmail @to = 'whoever@yourcompany.com',          
                                            @profile_name = 'default',          
                                            @subject = 'Someone was speeding',          
                                            @body = 'Yep, they sure were.';    
END END GO