No nonsense, please see the details below.
use db_CSharp go select *, Remark = case When grade > = 90 then 'excellent results' When grade < 90 and grade > = 80 then 'good grades' When grade < 80 and grade > = 70 then 'pass grade' Else 'fail' end from tb_Grade
If you just execute a statement, is it the same with go
If multiple statements are separated by go, it is not the same
Each statement separated by go is a separate transaction. The failure of one statement will not affect the execution of other statements.
First, execute the statements below at the same time
select * from sysobjects where id=a select getdate()
You will find that an error is reported and no result set is displayed
And you do it again
select * from sysobjects where id=a go select getdate() go
You will find that the result set contains the result of select getdate() although the error is also reported.
PS: usage of go in SQL Server
Signaling Microsoft? SQL Server ™ Utility the end of a batch of transact SQL statements.
Go is not a transact SQL statement; it is a command recognized by OSQL and ISQL utilities and SQL Server Query Analyzer.
If your SQL is too long, you need to write go, or there are some statements, which can only be operated by the first sentence. Before that, you have to write go. Go means to process statements in batches. If you add this go, you will execute the code of go line, and then execute the next code
In cases like this, go is used to process data in batches
use master go if exists (select * from sysdatabases where name = 'kejianDB') drop database kejianDB go create database kejianDB go use kejianDB go --(industry table) create table Trade ( tra_ Id int primary key identity (1,1) not null, -- industry ID (primary key, self growth) tra_ Name varchar (50) not null -- industry name ) go
The above is the whole description of this article, I hope you like it.