Click here to Skip to main content
15,913,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
unfortunately deleted records from table, so how to retrieve deleted record of table.
Posted
Comments
bbirajdar 31-Oct-12 6:51am    
No. You cannot..Thats why it is called as 'delete' and not 'hide'

If your database is in full recovery mode then it is possible to restore it back in time. Otherwise you need to restore a backup to get that data back.

else u can try this also

SQL Server keeps log for each deleted records. you can query these logs via 'fn_dblog' sql server function.
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.
refer this: http://raresql.com/2011/10/22/how-to-recover-deleted-data-from-sql-sever/[^]
 
Share this answer
 
There is no way to do this. Once you deleted the data, you'll not be able to recover it, until and unless you have a external recovery option.

You can only prevent the data loss using Transactions[^]. Because a Rollback[^] option is there with it to rollback the data of previous stage.


     --Amit
 
Share this answer
 
Don't delete records from your table just add a new column which save true or false. When you want to delete it then just update that record's column value to false. After that whenever you want to undo the deleted operation fire another update statement to change status of the record to true. And whenever you want only not deleted record add where clause in your select statement to check the recordStatus to determine it is deleted or not using true or false.
 
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