tags:

views:

31

answers:

3

Is there anyway of getting the creation date of an entry in an SQL Server table? The reason I want to know the creation time of an entry is for debugging purposes.

A: 

AFAIK- No, unless you have a field for that and you are setting it when doing INSERT/UPDATE

shahkalpesh
ok.. i hope you're wrong :). But i think you're right... i'll wait and see..
seanlinmt
:). Why will a DBMS do a job without you telling it to?
shahkalpesh
who knows.. I'm not an expert. Life is full of surprises. Too bad no surprises here. :)
seanlinmt
A: 

If you are logging your transactions, then you can analyze the transaction log to see all the INSERT, UPDATE and DELETE statements. I'm no expert by any means, but depending on your SQL Server version, you may be able to find a tutorial somewhere. Here's one for SQL 2000.

womp
A: 

You can add a datetime field with a default value of GETDATE() to retain the creation date of a record. There is no supported way of retrieving this info after the fact. In theory you can walk the log and find the log entry for the insert, but that requires use of undocumented functions like fn_dblog() or specialized third party tools like SQL Apex.

Remus Rusanu