Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases Modifying Data with SQL Handling Errors When Manipulating Data Rolling Back from Transactions

Can you rollback a DELETE statement?

I was wondering if you can roll back a delete statement since they were said to be a permanent change, though if it was not yet committed, can it be rolled back..

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

As a rule, you can't rollback data that you have deleted. But it's a little complicated depending on which version of SQL you're using. The transaction syntax might be a little different

Here's a bit more detail. :-)

https://stackoverflow.com/questions/39725810/is-it-possible-to-rollback-delete-drop-and-truncate/52177195

https://stackoverflow.com/questions/15472775/how-to-rollback-delete-command-without-using-transaction

Oh okay thanks a ton! I understand now. I'll stick to general rule then.