SQL Update Trigger Column Name

can't find a way to do it anywhere. I have an SQL trigger that fires when upgrading. A trigger copies some update information to another table that elses uses. Among the submitted details is the name of the updated column. There are many, many potential columns that have been updated (although only one at any given time), and I could just use something like:

IF UPDATE(ThisColumn)
BEGIN
   Do stuff with ThisColumn
END
IF UPDATE(ThatColumn)
BEGIN
   Do same stuff with ThatColumn
END

But, as I said, there are a lot of columns in this table, and I'm sure there must be an elgant way to get the name of the column that has been updated, without entering pages of essentially the same IF statements.

Thanks in advance!

+3
source share
1

COLUMNS_UPDATED

1,

2, KB 232195 , , sys.columns.column_id

,

: - , sys.columns . , . "EXECUTE AS OWNER"

+2

Source: https://habr.com/ru/post/1716909/


All Articles