Running multiple compare scripts in sequence within app.
Brian Donahue
Posts: 6,590 Bronze 1
Hi Chiefley,
It looks like you could do what you need to do by commenting out the COMMIT TRANSACTION at the end of the first script and also the BEGIN TRANSACTION near the top of the second script. This should get both scripts together as one transaction that will only commit if both scripts run successfully.
It will also cause the ROLLBACKs to affect both scripts as well.
You'd want to concatenate the script files into one unless you can run both script files through the same connection to the SQL database.
It looks like you could do what you need to do by commenting out the COMMIT TRANSACTION at the end of the first script and also the BEGIN TRANSACTION near the top of the second script. This should get both scripts together as one transaction that will only commit if both scripts run successfully.
It will also cause the ROLLBACKs to affect both scripts as well.
You'd want to concatenate the script files into one unless you can run both script files through the same connection to the SQL database.
This discussion has been closed.
Comments
That should do it. As long as the connection stays open, the server should only commit the transaction when it gets the COMMIT TRAN from the final script, provided there is a BEGIN TRAN at the top of the first script.