Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is it possible to check when a specific row was inserted into a specific table in SQL Server ? The table has an index if this any help.

And I need to do this for an existing table where the row has already being inserted.

Thanks.

share|improve this question

2 Answers 2

Transaction logs contain this info. You can use some third party tools to read transaction logs and transaction log backups. They can provide when the row was inserted for the transactions that had happened even before they were installed.

Besides the info when and what has happened, they can provide WHO has done it, which can be very useful

share|improve this answer

To achieve this retrospectively you could do so by inspecting the contents of the transaction log to identify when the insert occurred, of course you need to have access to the relevant transaction log that contains the details.

Here is a walkthrough of how you would inspect the transaction log to locate a table drop event but the process you would follow is mostly the same.

If auditing of this level is actually something that's required then your best bet is to build it into your overall solution, whether through the use of DML Triggers, CDC or Change Tracking or a customised solution.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.