RYAN
RYAN

Reputation: 39

restore a deleted data in my table to its original status

is there an sql code that will restore the data from my table, the table should contain the data that existed before I made the changes.

Here is my original data:

Insert into  EMP_1 (EMP_NUM, EMP_LNAME,EMP_FNAME,EMP_INITIAL, EMP_HIREDATE, JOB_CODE)
values (103, 'Arbough', 'June', 'E', '01-Dec-96', 503),
(104, 'Ramoras', 'Anne', 'K','15-Nov-87', 501),
(105, 'Johnson', 'Alice', 'k','01-Feb-93', 502),
(106, 'Smithfield', 'William', null, '22-Jun-04', 500),
(107, 'Alonzo', 'Maria', 'D','10-Oct-93', 500),
(108, 'Washington', 'Ralph', 'B', '22-Aug-91', 501),
(109, 'Smith', 'Larry', 'W', '18-Jul-97', 501);

and heres the result after i deleted William Smithfield:

enter image description here

this is my code for deleting it:

Delete from EMP_1 
where EMP_FNAME = 'William' 
and EMP_LNAME = 'Smithfield' 
and EMP_HIREDATE = '2004-06-22' 
and JOB_CODE = 500

Upvotes: 0

Views: 92

Answers (1)

Neha
Neha

Reputation: 197

If you want to recover the data, no it is not possible with no history table.

Is there is a reason to do hard delete, I would suggest you to use soft delete, as in to have IsDeleted column in the table, and make it true or false, if you are not having and history tables.

if you want to reenter the data which you had, and you have first column as Identity column, then Set Identity off and on, and insert the data.

Upvotes: 1

Related Questions