Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I executed a delete query without including in a transaction. now i want to undo the deletion what shoul i do?
please help me!!
Posted

Wanlambok wrote:
I executed a delete query without including in a transaction.


I doubt it can be retrieved anymore! Without transaction it is done and gone... If SQL log files or history table in place, you might get some info related to it but not the whole record!
 
Share this answer
 
If you take regular backups of the database, you can get your data back using this backup.
 
Share this answer
 
Comments
Ankur\m/ 4-May-10 3:13am    
Yes, that would be the best option. But in case you don't have the backups, you may need to buy some third party tools to do this.
There are third-party tools to do this. The tool should be able to go into the transaction logs and view the log entries so you can see what happened. There is one by Red-Gate: SQL Log Rescue[^].
Also check this post: MSDN -undo delete statement...is it possible?[^]
 
Share this answer
 
Server keeps log for each deleted records.You can query these logs via 'fn_dblog' sql server function with the table name "Employee" and it will give you all the deleted records from the log.
SQL
Select [RowLog Contents 0] FROM   sys.fn_dblog(NULL, NULL) WHERE  AllocUnitName = 'dbo.TableName'        AND Context IN ( 'LCX_MARK_AS_GHOST', 'LCX_HEAP' )        AND Operation in ( 'LOP_DELETE_ROWS' )
But this log is in Hex format. and you need to convert this Hex format to your actual data.

Given below is the article will help you to recover the deleted records in the same way defined above.

http://raresql.com/2011/10/22/how-to-recover-deleted-data-from-sql-sever/

Muhammad Imran
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900