I have created a trigger to returns the affected column names.[Trg_MyMaster] But Its not returning the last column name if I update the last column (Table Name is MyMaster].
But MyTest table is created from MyMaster and created the same Trigger. [Trg_MyTest] returns the last column name correctly if I update the last column in MyTest table.
records and table structure are same between both table.
Create TRIGGER [Trg_MyTest] ON [dbo].[MyTest] FOR UPDATE
Begin Print COLUMNS_UPDATED() Set @TableName='MyTest'
asked Jul 28, 2011 at 04:52 AM in Default
if you are running on SQL Server 2008 then MSDN COLUMNS_UPDATED (Transact-SQL) says:
Your trigger can be much more easier. On SQL Server you need to use column_id