Error: “Must declare the scalar variable” for insert statements in multiple database

后端 未结 3 2042
梦如初夏
梦如初夏 2021-02-07 11:34

I created a SQL script to add an entry in different database. However, when I run the script through SQL Server Management Studio.

declare @address varchar(50)
s         


        
3条回答
  •  天命终不由人
    2021-02-07 12:10

    It's the GO statement.

    all local variable declarations must be grouped in a single batch. This is done by not having a GO command until after the last statement that references the variable. (from MSDN)

提交回复
热议问题