How can I recover a table that I dropped in SQL?

owen

I accidentally deleted a table when I meant to delete a column. It was just a moment when I was thinking about other things and entered in DROP TABLE XXXX. when I meant to enter ALTER TABLE XXXX. Is there any way to recover the table? I can dig into the backups, so it's not the end of the world, but that's not how I hoped to spend my Friday morning.

Tags: SQL, table
Topic: Business
Answer this Question

Answers

3 total
jimlynch
Vote Up (3)

I think Christopher covered it well. It's crucial to have backups ready in case something like this happens. If you don't have them, you could be stuck with no options.

rousseau
Vote Up (2)

Christopher pretty much covers it. It's amazingly how a momentary slip-up can cause a major head ache. Good luck!

Christopher Nerney
Vote Up (2)

According to many commenters at Ask SQL Server Central, if you don't have a back-up, you're going to be out of luck.

 

However, one person writes, "There is an outside chance of getting the data if your O/S backup had an open file agent. Ask your backup team if they can restore from prior to the issue to a test environment and you may be able to get the data."

 

It's pretty much the same conclusion here: Forget about it, unless..."If the DROP TABLE was executed from within a transaction and that transaction has not yet been committed, you can roll it back."

 

Beyond that, some people suggest purchase or downloading a free trial version of a third-party product that is able to read the log file and reconstuct the table from that information.

 


 


 


Ask a question

Join Now or Sign In to ask a question.
The Donald wants FundAnything to be like Kickstarter, only gaudier
If comparing Bing and Google on regular search results isn’t enough, try comparing them based on autocomplete suggestions
BMC has agreed to be acquired by a private investment consortium headed by Bain Capital and Golden Capital, in a deal worth about US$6.9 billion.
A German company has trademarked the term 'hackathon'
Tip-toeing through the tulips of topical tech tales
If you like access to government data, like petition signatures or broccoli crop yields, the White House has got you covered
Doug Feigelson is a true entrepreneur, one who has built a successful business out of a custom solution he designed as part of another venture. He says he’d rather "fail completely" than sell his company, and, as a third-year computer science student at MIT, he regularly turns down job offers so he can focus on his startup.
U.S. labor data suggests that a significant portion of programmers leave the job in middle age
Yesterday Hulu shared good news about traffic and a few new shows. Netflix wasted no time responding with news of its next new show. Meanwhile Nielsen is finally taking baby steps towards tracking online viewing.
Trond Werner Hansen, the designer of some of the Opera Web browser's signature interface features, has been sued by that company in Norway for 20 million kroner ($3.4 million).