Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 undo a delete

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2007-04-25 : 11:47:06
through asp i executed a delete statement -- is there anyway to undo this?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-25 : 12:00:29
Not unless it is part of transaction.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

rapplewhite
Starting Member

2 Posts

Posted - 2007-04-25 : 12:07:24
Deletes cannot be undone in sql unless they are part of a transaction process, in which you can either commit or rollback the transaction. Sorry.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-25 : 13:43:58
Restore a backup to a new, temporary, database. If you have transaction log backups (i.e. Full Recovery Model) you can restore to the exact point-in-time when the delete occurred - if necessary take one-more TLog backup, from after the accidental deletion, so that you have TLog backups at least up to the accident's time.

From the Temporary database use:

INSERT INTO MyMasterDatabase.dbo.MyTable
SELECT *
FROM MyTEMPDatabase.dbo.MyTable
WHERE ... some criteria identifying the deleted records ...

When you are done Drop the Temporary database

Kristen
Go to Top of Page
   

- Advertisement -