0

I accidentally deleted all data rows from a important table. But unfortunately, the last backup of the database was done last week.

I have tried several ways, namely by looking at the transaction id and returning it with a query. but from the review I can also be more dangerous because it can eliminate some data

How can I restore the data that I deleted?

Kevin Turnip
  • 1
  • 1
  • 1

1 Answers1

2

It would seem that the before and after states would be recorded in the transaction log. Here is a step by step article on recovering deleted data from the SQL Server transaction log. You can create a db copy from the transaction log right before the delete and get a copy of the data from that point.

 RESTORE LOG Databasename_COPY FROM DISK = N'D:\Databasename\TranLog.trn' WITH STOPBEFOREMARK = 'lsn:0x0000001'

Recover Deleted Data From SQL Server Table by Transaction Logs

Edit: I just saw this solution on another answer. It does not require backups and actually converts the data. It may have some issues with max length datatypes and such, so you would have to check the data.

How to recover deleted data from SQL Server

Which is referred to in an answer in the following question.

How do I get back some deleted records?

Paul W
  • 146
  • 4