Sql server trigger if updating

COLUMNS_UPDATED returns one or more bytes that are ordered from left to right, with the least significant bit in each byte being the rightmost.

The rightmost bit of the leftmost byte represents the first column in the table; the next bit to the left represents the second column, and so on.

The column can be of any data type supported by SQL Server.

UPDATE() is used anywhere inside the body of a Transact-SQL INSERT or UPDATE trigger to test whether the trigger should execute certain actions. If I comment out the where then the modified information is updated in every case. Walter ALTER TRIGGER [dbo].[tr_SCHEDULE_Modified] ON [dbo].[SCHEDULE] AFTER UPDATE AS BEGIN SET NOCOUNT ON; UPDATE SCHEDULE SET modified = GETDATE() , Modified User = SUSER_NAME() , Modified Host = HOST_NAME() FROM SCHEDULE S INNER JOIN Inserted I on S. To test for updates or inserts to specific columns, follow the syntax with a bitwise operator and an integer bitmask of the columns being tested.For example, table t1 contains columns C1, C2, C3, C4, and C5.

Leave a Reply