How to configure the session to stop executing all following commands on first error?

35 Views Asked by At

Suppose I have a script:

alter table ....
go

insert into ...
go

alter table ...
go

delete from ..
go

How do I configure this session at the beginning of this script, so that if any of the four commands raises any error, all following commands in the script are skipped?

I don't want to do anything to these commands themselves, such as adding "raiseerror" and try/catch etc. All I want to do is to add something at the beginning of the script, so that the "abort on error" will happen automatically.

0

There are 0 best solutions below