select * from sys.objectsdeclare @i intselect @@rowcount
use tempdbgo--Creating the tablecreate table Demo (i int, j int, TimeUpdated datetime)go--Creating the triggercreate trigger DocumentUpdateTimeon Demofor update, insertas--Doing an update without using varibles.--More recommended because the update--can effect many rowsupdate Demoset TimeUpdated = getdate()from Demo inner join Insertedon Demo.i = Inserted.i and Demo.j = Inserted.jgoinsert into Demo (i, j)select 1,1union allselect 1,1union allselect 1,2goupdate Demo set j = 4 where j = 2gowaitfor delay '00:00:01'update Demo set j = 3 where j = 1go--Notice that the value of TimeUpdatedselect * from Demoupdate Demo set j = 1--Notice that again it modified the column--TimeUpdated. If I was using varibles,--it would update some of the recordsselect * from Demogodrop table Demo