sql server - Update field in a table with trigger after insert and update -
i have trigger in database.
create trigger trigg_varer_ledit_iu on items insert, update begin update items set lastedit = getdate() itemnr in (select itemnr inserted) end;
it works good. every time update , insert new data items "lastedit" field updated.
but: have spesific fields in table should not trigger update lastedit field. how can achieve that?
now works every fields updated. need keep of them out of circus.
you can use if construct check. example on updates inserted.column = deleted.column
related question - compare deleted , inserted table in sql server 2008
Comments
Post a Comment