代码之家  ›  专栏  ›  技术社区  ›  PP.

SQL Server 2005中的一行上有多个命令

  •  15
  • PP.  · 技术社区  · 15 年前

    我想在SQLServer2005中的一行上执行多个语句。如何在单行上执行以下操作:

    
    use master
    go
    sp_spaceused mytable
    

    当我尝试 use master; go; sp_spaceused mytable 我得到 Incorrect syntax near 'go' .

    当我尝试 use master go sp_spaceused mytable 我明白了 “go”附近有语法错误 .

    3 回复  |  直到 11 年前
        1
  •  15
  •   davek    15 年前
        2
  •  8
  •   Alex Shirshov    15 年前

        3
  •  1
  •   Undo ptrk    11 年前

    DECLARE @x int; DECLARE @x int;