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
 Transact-SQL (2000)
 DML Timestamp

Author  Topic 

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2007-08-07 : 09:58:26
Guys,

Is there any way to get timestamp of the last DML operation performed on a table. I tried 'sysobjects' it only holds create date 'crdate'.

To get around this I have added new columns DATE_TIME_CREATED, which has default value of getdate() each time when new row is inserted or updated, but it does not cover scenario of deleting a row.

Any suggestions and inputs would help.

Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-07 : 11:38:38
in sql server 2000 there isn't.
and you probably can't have triggers on sysobjects.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2007-08-07 : 14:38:12
My working and Production environment is sql server 2005, is there anyway to accomplish this in 2005.

Thanks
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-07 : 15:34:28
you have modify_date in sys.objects

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2007-08-07 : 17:08:08
spirit1

Thank you for your reply.

modify_date only gives date modified for DDL, if you insert delete, update rows from the table it doesnt update the date modified field.

I want a date field which stores the last time when DML operation was run on a table

Thanks
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-07 : 22:59:59
Then you need add a datetime column in the table to keep track of dml.
Go to Top of Page

sbalaji
Starting Member

48 Posts

Posted - 2007-08-08 : 01:33:41
If your are doing physical delete then you have to maintain the information in separate table,(like history/audit table whatever you may call)
Go to Top of Page
   

- Advertisement -