Please start any new threads on our new
site at http://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Our new SQL Server Forums are live!
Come on over! We've restricted the ability to create new threads on these forums.
Flowing Fount of Yak Knowledge
Aged Yak Warrior
Premature Yak Congratulator
quote:Originally posted by vaibhavktiwari83Create a column LastModifiedDate in your table and at the time of insert use Getdate() as value for that column.Vaibhav T
Very Important crosS Applying yaK Herder
quote:Originally posted by madhivananquote:Originally posted by vaibhavktiwari83Create a column LastModifiedDate in your table and at the time of insert use Getdate() as value for that column.Vaibhav TBetter option is to create that column with default value of getdate()MadhivananFailing to plan is Planning to fail
quote:Originally posted by kirangentlebreeze1987sorry,i am new to sqlserver can you explain me in a clear way?thanks kkk
CREATE TRIGGER AuditTrail_YourTable
IF NOT UPDATE(LastModifiedDate)
FROM YourTable y
INNER JOIN INSERTED i
SELECT TOP 1 * FROM Table ORDER BY LastModifiedDate DESC
SELECT TOP 1 WITH TIES * FROM Table ORDER BY LastModifiedDate DESC