If you want some SQL statements to execute only if certain conditions are met, then you will just need to put them in a CASE or IF statement. If you mean that you want to execute them outside of a transaction, that's not really possible, unless you first issue a COMMIT WORK or ROLLBACK WORK. Anything SQL wise that is placed between the BEGIN WORK and one of the former will become part of the transaction.
Transactions were designed to allow any changes made to a database to be un-done, if somewhere along the way an error is encountered in order to maintain database integrity. Preferrably, though, one will want to keep transactions as short as possible, even "wrapping" an SQL statement wherever viable.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.