正文

untitled

(2014-07-28 09:33:04) 下一個
sp_help
sp_helpindex
sp_helptext

sysobjects
OBJECT_ID( )
syscomments
sys.sql_modules

GO
ONLY in SSMS, a batch separator/terminator, you can change it to whatever you want.

It is used to group SQL commands into batches which are sent to the server together.

CREATE DEFAULT, CREATE FUNCTION, CREATE PROCEDURE, CREATE RULE, CREATE TRIGGER, and CREATE VIEW statements cannot be combined with other statements in a batch. The CREATE statement must begin the batch. All other statements that follow in that batch will be interpreted as part of the definition of the first CREATE statement.

The commands included in the batch, that is, the set of commands since the last GO command or the start of the session, must be logically consistent.

For example, you can't define a variable in one batch and then use it in another since the scope of the variable is limited to the batch in which it's defined.

Any declarations of Variables, Table Variables, etc do not go across
 GO statements.

#Temp tables are local to a connection, so they span across GO statements.


GO n                       ( n as int)
...
GO
INSERT INTO .....
GO 10
execute the insert command 10 times.
GO will execute the code since the last GOn times.


; SEMICOLON
It is a statement terminator/delimiter, defined in STANDARDsrequired in SS 2014 and after, especially required before CTE ( with clause ) and after MERGE statement.



[ 打印 ]
閱讀 ()評論 (0)
評論
目前還沒有任何評論
登錄後才可評論.