Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 table modified???

Author  Topic 

svicky9
Posting Yak Master

232 Posts

Posted - 2006-01-22 : 15:50:29
How do i know when was the database modified

Thanks
Vic

Kristen
Test

22859 Posts

Posted - 2006-01-22 : 16:57:56
The structure of the table or a record within it?

Kristen
Go to Top of Page

svicky9
Posting Yak Master

232 Posts

Posted - 2006-01-22 : 17:38:35
the Record within it

Vicky
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-01-23 : 02:06:06
Couple of things you could do:

Add columns to the table for CreateDate and UpdateDate. Set both using DEFAULTs (so they get the date of creation when a new row is inserted).

Then either set the UpdateDate in your application (but you must do it everywhere you make an update), or create a database TRIGGER which can automatically set the date whenever the record is changed.

We do it in the application (actually in the Stored Procedures that insert/update records) because if we bulk-copy records from somewhere else we want them to retain the UpdateDate from the original source, and not the time that we transferred them to the new database (we can deliberately set the updateDate as part of the transfer if that's what we want, but we do want the flexibility to retain the original [we could disable the trigger whilst doing the transfer but that's a bit of a blunt weapon!]).

So two routes for you and your application to choose from!

Kristen
Go to Top of Page
   

- Advertisement -