General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Hi,
I've seen COLUMNS_UPDATED this but for me it's un-usable,
because:
a) I don't know how mayn columns there are (well I won't to make
it so it doesn't matter)
b) I'm checking all columns...
c) I need the value and name of the updated column.
For example
Column 1 is updated
IF (COLUMNS_UPDATED()=1)
But how do I get COLUMNS_UPDATED's name, old and new value without
refering to the column by name?
As I see it the COLUMNS_UPDATE is useless because
I still need to use the name...in
inserted.column_name
This is dead easy on Oracle I read all my SQL Server books
and there seems to be nothing even close..
Maybe it's easiest if I put it in pseudo code.
FOR ALL COLUMNS IN THE COLUMNS UPDATED BITMAP (possibly exluding some named
columns!)
store the old and new value in a log table
i.e.
FOR EACH UPDATED COLUMN
@name=COLUMN(i).NAME
@oldvalue=COLUMN(i).NAME
@newvalue=COLUMNS(i).NAME
ENDFOR
Know what I mean?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only