SQL Server GO

Source: Internet
Author: User
Tags sql server query

SQL Server GO

For more information, see the following.

Use db_CSharpgo select *, remarks = case when Grade> = 90 then 'excellent score 'when Grade <90 and Grade> = 80 then' excellent score 'when Grade <80 and Grade> = 70 then' pass 'else' failed' end from tb_Grade

If you only execute a statement, all GO statements are the same.

If multiple statements are separated by GO, they are different.

Each statement separated by GO is a separate transaction. A statement execution failure does not affect the execution of other statements.

For example:

First, execute the following statement simultaneously.

select * from sysobjects where id=aselect getdate()

You will find that an error is reported and no result set is displayed.

And you can execute

select * from sysobjects where id=agoselect getdate()go

You will find that, even if an error is reported, the results include the results of select getdate.

Ps: SQL SERVER GO usage

Notify Microsoft by Signal®SQL Server™The end of a batch of Transact-SQL statements.
GO is not a Transact-SQL statement, but a command recognized by osql and isql utilities and SQL Server Query analyzer.

If your SQL statement is too long, you need to write GO or some statements. It can only be the first operation. You have to write GO before, GO means to add this GO to the batch processing statement, execute the code of the GO line, and then execute the following code ......

In such cases, GO is required to process data in batches ......

Use mastergoif exists (select * from sysdatabases where name = 'kejiandb') drop database kejianDBgocreate database kejianDBgouse kejianDBgo -- (Industry table) create table Trade (tra_Id int primary key identity (1, 1) not null, -- industry ID (primary key, auto-increment) tra_Name varchar (50) not null -- industry name) go

All of the above are described in this article. I hope you will like it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.