Kd5490
Kd5490

Reputation: 31

Check if any columns changed in a trigger

I have a table that consists of 30 columns. In another table I have a list of the columns for that table. Some have an indicator as 0 and others with 1.

I need to that that tables of columns were the indicator = 1 and find out if that column updated during a trigger or not. I need this to be simple and with the least amount of code to implement

Can I use columns_updated? or Updated?

Any help would be appreciated.

Upvotes: 0

Views: 166

Answers (1)

David Dubois
David Dubois

Reputation: 3932

Are you looking for the UPDATE function?

create trigger PersonUpdateTrigger on Person for update as
begin
  if UPDATE(Notes) 
    begin
      -- The Notes field was set in the UPDATE command
    end 
end

Upvotes: 1

Related Questions