Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refer to Column by position in a trigger
Message
From
12/07/2001 03:55:21
 
 
To
10/07/2001 17:00:02
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00528593
Message ID:
00529581
Views:
18
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
Map
View

Click here to load this message in the networking platform