if NOT (some condition)
begin
..
..
end
else
begin
..
..
end
You need the begin...end if you are going to do multiple statments in the TRUE or FALSE parts of the IF.
>Hi,
>
>Is there any way in Query analyzer to:
>
>1) return from an ENTIRE script instead of just a batch within the script? I would like to (within my sql file) check for a condition, and if not acceptable, NOT run the entire file regardless of how many batches (as defined with 'go') there are. For example:
>if NOT (some condition)
> return
> do something
> go
>
>do something else
>go
>
>do something else
>go
>If (some condition) fails, I don't want ANY of the remainder of the script to run.
>
>
>2)call one sql script from within another?
>
>Thanks!