I have a block of script like this:
IF NON EXISTS (select 1 from client where clientid = 1) <------- LINE1
RETURN; <-------- LINE2
IF column 1 does not exists alter table ......
IF table_A not exists create table_A
The problem is that after LINE2 is exec, it continue to EXEC the rest of the scripts. The intention is to exit the script if LINE1 returns true.
BTW, I cannot use EXIT, because it is called by other script, which will handle the exception differently.
Because the rest of script is so large, I do wish to keep the GO between the script lines.
Is there anyone can help me figure out what goes on here?
Thanks in advance.