sql - TSQL After Update Trigger check for update on multiple columns in one IF UPDATE -
The original syntax for triggering the update in TSQL is:
create triggers [ Dbo]. [DBO] on [Trigger Names] [Table] After updating, INSERT - transge or update the table when; If updated (column) - If the column update starts, then update table set column C = column A + column B - re-calculation of column C (column B) - if the column B update is initiated, update table set Column C = Column A + Column B - Column B. Resume and End
Now I can work up, I think, but is it possible to combine both together? Is:
if update (ColumnA) or (ColumnB) - if start column or column update No start-up Update table set column C = column A + column B-column counting of C and C
You can of course use the calculated columns, but By curiosity, I would like to know if you can check the updates on multiple columns at one time in the trigger and then update after the trigger revision.
This is a little late for comment.
UPDATE ()
is a function used in a trigger. There is no specific syntax as if update ()
. As far as I know, the trigger allows you to combine several conditions in the if
statement.
But, at this point even more, on However, I recommend that you use a calculation instead Use the made column. UPDATE () . There is a lot of examples used in the documentation:
if the (state proproven ID) or update (postal code) RAISARR (5, 9, 16, 10) end; Therefore, use the correct syntax for yourself and you will be okay:
if updated (column) or update (column B) - if the column Start A or column B update start table set column C = column A + column B - re-calculate column C and end
Comments
Post a Comment