Today's script is a template I use for the occasions when a data edit is required to be run against a live environment. It has 8 steps to give you as DBA's control over what is being run and the safety of recording results before and after the modifications. The comments section at the top is used to give you an instant view of who, what and where about the script.
----------------------------------------------------------------- Live Change Data Edit Script Template - Results to Text (Ctrl+T) ----------------------------------------------------------------- ----------------------------------------------------------------- For more SQL resources, check out SQLServer365.blogspot.com ----------------------------------------------------------------- You may alter this code for your own purposes. You may republish altered code as long as you give due credit. You must obtain prior permission before blogging this code. THIS CODE AND INFORMATION ARE PROVIDED "AS IS" ----------------------------------------------------------------- -- Run select statement(s) before data modifications for historical record -- Record results before data modifications -- Start of data modifications - Use BEGIN TRANSACTION to allow rollback if errors or unexpected results occur PRINT '*** START DATA MODIFICATIONS ***' -- End of data modifications PRINT '*** END OF DATA MODIFICATIONS' -- COMMIT OR ROLLBACK? - FOR DBA USE WHEN BEING EXECUTED LEAVE COMMENTED OUT! -- Run select statement(s) after data modifications -- Record results after data modifications for historical record */
Enjoy!
Chris