December 29, 2003 at 10:18 pm
Hello Friends!
I have a trouble to get specific row and column when updated, inserted or deleted trigger is fired. I don't want to rollback those transactions but I would like to know which row, which column is updated and store
these data in another table for history. Please help me!
December 30, 2003 at 3:44 am
The row that got updated can be found from the INSERTED or DELETED table. Those tables have the same layout as your source table, so if you take the PK-fields from either of them (depending on the type of trigger/action), you get a pointer to the row(s) that got updated.
For the columns, you could use the COLUMNS_UPDATED() function. This gives you a bitmask of which columns where updated. Check BOL for specific info.
Don't know how this works if you have a recordset that got changed.
December 30, 2003 at 3:56 am
Piggy-backing on Noel I found this http://www.umachandar.com/technical/SQL70Scripts/Main36.htm to be useful when dealing with COLUMNS_UPDATED()
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
January 1, 2004 at 4:12 am
Hi NPeeters and Frank,
Thank you so much for your advices. I solved my problem.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply