I'm trying to build and audit table and record only those column values that have changed during a form update. To do this, I check the column with a trigger using the IF UPDATE clause. For example:
If update (PRACNAME) select @PRACNAME = PRACNAME from deleted
From there I write the value of @PRACNAME into my audit table.
I would expect that if PRACNAME was NOT changed from it's previous value (i.e. updated value = deleted value), it would be skipped by the if statement. What is happening however, is that the data for every column gets written to the table every time whether it was changed or not.
I've tried doing this other ways and it works but it's clunky. It would be much better if I could get If Update to work. Any thoughts out there?
Jim
If update (PRACNAME) select @PRACNAME = PRACNAME from deleted
From there I write the value of @PRACNAME into my audit table.
I would expect that if PRACNAME was NOT changed from it's previous value (i.e. updated value = deleted value), it would be skipped by the if statement. What is happening however, is that the data for every column gets written to the table every time whether it was changed or not.
I've tried doing this other ways and it works but it's clunky. It would be much better if I could get If Update to work. Any thoughts out there?
Jim