« New Video: SQL Server 2008 T-SQL Enhancements | Main | Another SSMS 2008 Improvement: DROP and CREATE »

April 01, 2009

Getting Ready to do Something you Might Regret?

If you're mucking around in your database, and need to save your changes in a transactionally safe manner, but JUST might want to leave a flag or some kind of marker that would let you know what you need to return to should you later on decide it was a bad idea, then SQL Server has you covered:

BEGIN TRAN PrePlunge
WITH MARK 'Prior to Doing Stuff I might Regret'

Then, if you decide you need to undo your changes, you can always throw in the STOPATMARK clause as part of a RESTORE + RECOVERY. (Of course, ANY changes you've made SINCE that mark are toast, but it's still nice to have the option.)

Books Online covers this in a bit more detail, and it works with SQL Server 2000, 2005, and 2008.


Bookmark and Share


Comments


 

Post a comment

(Not displayed - [privacy policy])

Remember personal info?

 

spacer