all groups > sql server programming > june 2003 >
You're in the

sql server programming

group:

Does sql allow us to find out when a table has been changed?


Does sql allow us to find out when a table has been changed? Jesse Fitterer
6/30/2003 5:59:05 PM
sql server programming:
Without going to the table itself, can we determine if and when a table
has been changed after its creation date? I know the sysobjects will
list the creation date (crdate) but is there a way to see when the table
has been last updated. (Update,insert, delete)


*** Sent via Developersdex http://www.developersdex.com ***
Re: Does sql allow us to find out when a table has been changed? Ty
6/30/2003 8:08:28 PM
Here is a snippet which will work:

CREATE TRIGGER UpdateTracker
ON tblYourTable
FOR INSERT, UPDATE, DELETE
AS
BEGIN
--Update table timestamp
UPDATE logTableLastUpdated
SET lastmodified = CURRENT_TIMESTAMP
WHERE name = 'tblYourTable'
END


[quoted text, click to view]

Re: Does sql allow us to find out when a table has been changed? Andrew J. Kelly
6/30/2003 10:34:09 PM
No, not natively. You can add a trigger that will update a datetime column
but it has to be done manually.

--

Andrew J. Kelly
SQL Server MVP


[quoted text, click to view]

AddThis Social Bookmark Button