UPDATE() returns TRUE regardless of whether an INSERT or UPDATE attempt is successful.
To test for an INSERT or UPDATE action for more than one column, specify a separate UPDATE(column) clause following the first one. Multiple columns can also be tested for INSERT or UPDATE actions by using COLUMNS_UPDATED. This returns a bit pattern that indicates which columns were inserted or updated.
IF UPDATE returns the TRUE value in INSERT actions because the columns have either explicit values or implicit (NULL) values inserted.
UPDATE(column) can be used anywhere inside the body of a Transact-SQL trigger.
Note: |
|---|
|
In SQL Server 2000, UPDATE() does not detect changes to timestamp columns. For these columns, an IF UPDATE() clause inside a trigger body returns FALSE, regardless of whether the columns are updated. In SQL Server 2008 and SQL Server 2005, UPDATE() detects changes to timestamp columns. An IF UPDATE() clause inside a DML trigger body returns TRUE if these columns are updated.
|