January 23, 2003 at 4:20 pm
I have a table that I need to test a script against. If the script updates my table and I don't like the changes I want to replace it with a backup table. What is the best practices method for creating a copy of a table so I can use it replace a damaged table? Does anyone have any other ideas on how this should be done. Thanks
January 23, 2003 at 7:25 pm
Try using TRANSACTIONS.
BEGIN TRANSACTION
make you change
check your change
ROLLBACK TRANSACTION or COMMIT TRANSACTION
They have to all happen on the same connection. Losing the connection will autocommit. I usually test UPDATE statements this way by running BEGIN TRANSACTION, my update, the select to verify results in QA. Then if looks fine I type COMMIT TRANSACTION highlight it and run it in the safe connection, if I don't like the results I do ROLLBACK instead. However, I have never tried altering a table before so test somewhere to be sure and make a backup beforehand in case you make a mistake.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply