Posted by dmarkle on 01/15/07 13:11
Here's the trick with "GO":
It's not actually a part of the T-SQL language. It's a batch
separator. (Don't believe me? Try running "exec('GO')" in Query
Analyzer.)
Think of it like this: Cut up your script into multiple files,
separated by the "GO" statement. Run each of these files individually,
but use the same connection. That's all "GO" does.
So you need to remove the "GO" batch separators in between your
statements that need to be run in the same batch.
-Dave Markle
http://www.markleconsulting.com/blog
BF wrote:
> Hi,
>
> I have a problem:
> I am writing an update script for a database and want to check for the
> version and Goto the wright update script.
>
> So I read the version from a table and if it match I want to "Goto
> Versionxxx"
>
> Where Versionxxx: is set in the script with the right update script.
>
> Whenever I have some script which need Go commands I get error in the
> output that
>
> A GOTO statement references the label 'Versionxxx' but the label has
> not been declared.
>
> But the label is set in the script by 'Versionxxx:'
>
> Is there a way I can solve this easily?
>
> Thanks in advance
[Back to original message]
|