Aug 07 2024 10:26 AM
We need a trigger to be sent out if ProcessSchedule has had an INERT, UPDATE or DELETE
We don't need details just a heads up type of email.
The send email part is easy.
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'SQLMail'
,@recipients = 'email address removed for privacy reasons'
,@body = 'Press Schedule Changed'
,@subject = 'Press Schedule Changed'
The trigger part I have not done before.
Any help would be greatly appreciated.
Aug 08 2024 01:46 AM - edited Aug 08 2024 05:44 PM
use SQL Script below to create a trigger:
CREATE TRIGGER SendNotifyMail
ON ProcessSchedule
AFTER INSERT, UPDATE, DELETE
AS
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'SQLMail'
,@recipients = 'email address removed for privacy reasons'
,@body = 'Press Schedule Changed'
,@subject = 'Press Schedule Changed' ;
GO
And check out document https://learn.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql?view=sql-server-v... for more information
Aug 12 2024 09:39 AM
Aug 12 2024 07:50 PM
I used to add a rowversion column in table to identify which row had been modified. Its value will be auto increased with any update of the row. Check document here.
Aug 13 2024 09:12 AM