Forum Discussion
Ryan0827
Aug 07, 2023Copper Contributor
Compare current row fields with previous row fields and return field changes
I have a table (i.e. SourceTable) that contains an AFTER INSERT, UPDATE, DELETE trigger. When the trigger fires it copies the inserted row from INSERT & UPDATE triggers or the deleted row from DELETE...
LainRobertson
Aug 07, 2023Silver Contributor
You'd want to leverage the UPDATE() (most likely) or COLUMNS_UPDATED() (least likely) functions as per the doco:
- UPDATE() (Transact-SQL) - SQL Server | Microsoft Learn
- COLUMNS_UPDATED (Transact-SQL) - SQL Server | Microsoft Learn
Cheers,
Lain
Ryan_Hennings
Aug 07, 2023Copper Contributor
This doesn’t answer my question. I don’t need help with the trigger. I need help querying the audit table the trigger populates. My original post shows some sample data and how I need the query results to look.