noodle22
Programmer
- May 8, 2008
- 23
Hi,
I am using an Instead Of trigger for a table and I need a way to determine if a row has been updated. The problem is, if I do something like
UPDATE myTable SET [Name]='sameasbefore'
Then in the trigger, inserted and deleted both contain records for all the rows in my table even if the value of [Name] has not changed. One method I have tried is to first copy all the inserted records into a temp table. Then concat all the fields for the table and compare with those in the deleted table to see if there is a change. This seems like a pretty bad work around. Is there a setting or something I am missing?
The option I am currently thinking of is casting all the columns to varbinary(255) and then comparing the values to a previous has that was created when inserted. I don't really know if that is faster but I think it is effectively hashing the rows
Any ideas?
I am using an Instead Of trigger for a table and I need a way to determine if a row has been updated. The problem is, if I do something like
UPDATE myTable SET [Name]='sameasbefore'
Then in the trigger, inserted and deleted both contain records for all the rows in my table even if the value of [Name] has not changed. One method I have tried is to first copy all the inserted records into a temp table. Then concat all the fields for the table and compare with those in the deleted table to see if there is a change. This seems like a pretty bad work around. Is there a setting or something I am missing?
The option I am currently thinking of is casting all the columns to varbinary(255) and then comparing the values to a previous has that was created when inserted. I don't really know if that is faster but I think it is effectively hashing the rows
Any ideas?