Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server table
Can i restore my deleted rows (by Delete query) in a sqlserver table ????
pls help ..thanks in advance
Posted 16-Mar-13 5:21am
sr_24484
Comments
db7uk at 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.
ThePhantomUpvoter at 16-Mar-13 11:03am
   
No you cannot restore deleted records. You will have to restore from a backup.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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,
  Permalink  
Comments
sr_24 at 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 at 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,
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 14 Feb 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100