Click here to Skip to main content
15,566,615 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can i restore my deleted rows (by Delete query) in a sqlserver table ????
pls help ..thanks in advance
Posted
Comments
db7uk 16-Mar-13 10:41am    
What is the recovery mode set to on the database? what backup strategy do you have? If none of the above you cant.
[no name] 16-Mar-13 11:03am    
No you cannot restore deleted records. You will have to restore from a backup.

Hello,

Rows deleted can not be recovered after COMMIT operation. If COMMIT is already performed then only way I know to recover data is via database restore provided you have taken a backup before performing this operation.

Regards,
 
Share this answer
 
Comments
sr_24 16-Mar-13 10:59am    
if i write a simple delete query to delete a record , then Will Commit be performed automatically or i need to do it ....in case such case when i dont use commit , what could be done ??
Prasad Khandekar 16-Mar-13 11:17am    
Hello,

What you can do is to soft delete the records. I.e. Add a bit column in your table and set it's value to 1 for deleted records. Your actual query will only retrieve the records with this column value as 0. This way in future if you need to recover the records all you will have to do is to set the column value to 0 for deleted records.

By default autocommit is true and hence if you execute the delete query your records will actually get deleted.

Regards,
You might be able to restore your deleted rows.
If your database was in a full or bulk-logged recovery model you could use SQL Server point in time recovery. I suggest reading this post:
http://stackoverflow.com/questions/3540729/how-to-recover-deleted-rows-from-sql-server-table
 
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