Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to end the script
Message
 
À
11/06/2008 14:34:54
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01323190
Message ID:
01323214
Vues:
11
>>>I want to end the script at some point so the code after it does not run. I would just use CANCEL or RETURN in Forpro.
>>
>>Put GO statement to separate scripts from one another. It doesn't stop it, though, so you can use RETURN command.
>
>If GO doesn't stop the script, what does it do?

I can't write it any better than BOL so here is what it says in BOL:

GO is not a Transact-SQL statement; it is a command recognized by the sqlcmd and osql utilities and SQL Server Management Studio Code editor.

SQL Server utilities interpret GO as a signal that they should send the current batch of Transact-SQL statements to an instance of SQL Server. The current batch of statements is composed of all statements entered since the last GO, or since the start of the ad hoc session or script if this is the first GO.

A Transact-SQL statement cannot occupy the same line as a GO command. However, the line can contain comments.

Users must follow the rules for batches. For example, any execution of a stored procedure after the first statement in a batch must include the EXECUTE keyword. The scope of local (user-defined) variables is limited to a batch, and cannot be referenced after a GO command.
Semper ubi sub ubi.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform