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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sql server log file stores the every log in it possible to revert the query operation which we doing through query editor or by application based on the session we are logged in?

Thanks in Advance

share|improve this question

migrated from Oct 18 '12 at 11:50

This question came from our site for professional and enthusiast programmers.

Why not simply rollback your transaction? – a_horse_with_no_name Oct 18 '12 at 6:24
its a time consuming process. – parthasarathy Oct 18 '12 at 6:36
And you think digging through binary logfiles to undo a transaction will be faster? – a_horse_with_no_name Oct 18 '12 at 7:00

If you are using transactions, you can rollback your transaction.

If you are looking to restore your database, the answer is no. Providing that you are in Full Recovery model and have log backups, you can restore to a point in time, such as LSN, Time or Marked Transaction, but you cannot roll forward your restore on a session by session basis as this could leave the database in an inconsistent state.

Imagine your session deleted some rows from a table...What if another session had created those rows and you did not roll forward the other session? It just wouldnt work.

You could consider using Database Snapshots moving forward. This will give you a point-in-time copy of the database which you can use to "undo" data modifications. For example if your session deleted some rows, you could do an INSERT into your database, SELECT from snapshot

share|improve this answer

Your Answer


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