0

I would like to ask you a question I deleted data from table HR_EMPMAST and I want to roll back it the last delete. Could you help me please?

DELETE FROM HR_EMPMAST
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Kosal
  • 13
  • 1
  • 5
  • 1
    http://stackoverflow.com/questions/3540729/how-to-recover-deleted-rows-from-sql-server-table If your recovery mode set to full, it is possible to recover https://sqlbak.com/blog/recover-deleted-data-in-sql-server/ – Eric Jan 25 '17 at 02:26
  • If you're doing this inside an explicit **transaction** block (`BEGIN TRANSACTION .....`), then you could inspect the results and optionally issue a `ROLLBACK TRANSACTION` – marc_s Jan 25 '17 at 05:58
  • I would like to say thank you for your answer. I have database backup but column table not match i just add column and restore table with data from my database backup – Kosal Jan 25 '17 at 08:13
  • Sad life................ :'( – Kung Fu Panda Jan 16 '18 at 11:00

1 Answers1

1

The simple and sad answer is: you can not.

They only way to 'undo' such a DELETE FROM statement is if you actually have saved a back-up from your database from before the delete. You can then either import that back-up in full or you can use the IMPORT FROM statement.

Unfortunately, if you have not saved a copy, that data is lost. That is also why the sql admin asks you if you are sure you want to delete. in-revertible!

CDspace
  • 2,639
  • 18
  • 30
  • 36
hewi
  • 1,274
  • 3
  • 17
  • 32
  • You told OP "you can't" and then outlined how you can... There's some faulty logic in there. – SQL_Deadwood Jan 25 '17 at 03:46
  • there is no way of actually 'rolling back' like the CTRL-Z, that command does not exist. If you wrongfully deleted something, you can only hope for good backups. I have edited the post slightly, to clear the logic :) – hewi Jan 25 '17 at 08:11