I am writing a script that needs to do something like this:
IF [CONDITION]
BEGIN
--EXECUTE LOADS OF BATCHES (I.E. BLOCKS OF CODE WITH 'GO' AT THE END)
END
This appears not to be allowed. The GO
statement is not allowed in a BEGIN...END
block.
I've also tried this:
IF NOT [CONDITION] GOTO GetMeOutOfHere
--EXECUTE LOADS OF BATCHES (I.E. BLOCKS OF CODE WITH 'GO' AT THE END)
GetMeOutOfHere:
But, you guessed it, GOTO
doesn't work across batches.
Is there any solution to this confounded conundrum?