Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL timestamp on a table?

Status
Not open for further replies.

msc0tt

IS-IT--Management
Jun 25, 2002
281
CA
I know the SYSOBJECTS table has a CRDATE field for the table creation date. Is there a built-in way to tell when a table was last updated? (by built-in, I mean without triggers and code).
-thanks
 
As a follow-up note, what I *really* need to know is not so much when, but if a table has changed. Perhaps one of the other fields in the SYSOBJECTS record changes every time there is a change in the table?? Then I would just have to keep track of this value.
 
SQL Server has TIMESTAMP datatype which can be used in tables. With SQL Server 2000 the TIMESTAMP is really being called it's true name ROWVERSION as it's not a true time.

This value gets updated everytime there is a change made to the row.

Refer to the BOL on TIMESTAMP and ROWVERSION

-SQLBill

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine

Posting advice: FAQ481-4875
 
Thanks Bill. Yes, I knew about the [timestamp] column but was hoping to save the 8 bytes per row since I don't need to know specifically what row changed. Heck, disk is cheap so this is the way I'll go.
-thanks again.
 
You might also be able to use Profiler to create a trace file that could capture when UPDATES are done to a table. I've never done that myself, so I wouldn't be able to help - but it might be worth looking at.

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top