Can someone show me a trigger that would insert a timestamp into a column of a record everytime that record was changed? Something like a last updated trigger.
CREATE TRIGGER rec_updated
ON MyTable
FOR INSERT, UPDATE
AS
set nocount on
Update MyTable
Set UpdtDatetime=getdate()
From MyTable
Join inserted
-- join assumes that a unique column
-- names RecId exists on the table
On MyTable.RecID=inserted.RecId
set nocount off
Go Terry L. Broadbent - Salt Lake City, UT
Home of the 2002 Winter Olympics (Feb 8-24)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.