ustbwang 发表于 2018-10-14 12:15:08

SQL中GO的用法

USE pubs  GO
  DECLARE @MyMsg VARCHAR(50)
  SELECT @MyMsg = 'Hello, World.'
  GO -- @MyMsg is not valid after this GO ends the batch.
  -- Yields an error because @MyMsg not declared in this batch.
  PRINT @MyMsg
  GO
  SELECT @@VERSION;
  -- Yields an error: Must be EXEC sp_who if not first statement in
  -- batch.
  sp_who
  GO

页: [1]
查看完整版本: SQL中GO的用法