Forum Discussion
RuthlessRoth
Aug 07, 2024Copper Contributor
Trigger to send email if a table has had a INSERT, UPDATE OR DELETE
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...
RuthlessRoth
Aug 12, 2024Copper Contributor
Thanks. The trigger didn't work for this application. The issue is the table has a lot of Inserts, Updates and Deletes that do not relate to specific records. I resorted to a SQL Job to check every 30 minutes if a specific record or records have been modified within the past 30 minutes based on the data put into a UpdateDateTim field that is used when a record has been changed.
rodgerkong
Aug 13, 2024Iron Contributor
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 https://learn.microsoft.com/en-us/sql/t-sql/data-types/rowversion-transact-sql?view=sql-server-ver16.
- RuthlessRothAug 13, 2024Copper ContributorGood Idea. Downside I do not have control over the table structure. I am working with a application that I did not design. When updates are sent out to the software it checks table structure and resets it to their design.