• Michael L John - Thursday, May 18, 2017 12:09 PM

    john.wb - Thursday, May 18, 2017 6:44 AM

    Another good practice is to wrap any data affecting statements in a transaction but comment out the COMMIT TRAN. You can see how many rows are affected and issue a rollback if the number looks wrong.

    Not sure I agree that this is a good practice.  
    This was the "good practice" at a previous place I worked.  This caused a significant number of deadlocks while the users looked over the results of the query before doing the commit.

    Ad hoc queries on a live server aren't an amazingly good idea, especially untested ones.
    Better would be to test your script on the dev instance first with an approach of "do it", "check it", "roll back". Then check again with rollback on the live instance just in case something has changed, then run on live with a commit when you're absolutely happy.