Trigger if updating then
Would it introduce any issues in the system or not depends on implementation.However, it would always lead to unnecessary performance overhead. The code below creates another table and changes trigger in a way, that mimics behavior of audit functional, which is frequently implemented based on triggers. Audit ( ID int not null identity(1,1), On Date datetime2(0) not null constraint DEF_Audit_On Date default getutcdate(), Message varchar(64) not null, ) go alter trigger trg Data_AI on dbo.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 you choose to participate, the online survey will be presented to you when you leave the Msdn Web site. Our technologist looks at trigger maintenance and implementation challenges.
However, computed columns cannot be used in this context.
Now, whenever possible, I will go very far out of my way to avoid a trigger.
I have two primary reasons for avoiding triggers: Hopefully the first reason to avoid triggers, the maintenance headache, is fairly easy to see.
However, in some cases, we have to use triggers and it is important to develop them correctly.
SQL Server fires triggers on statement rather than row level.