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

后端 未结 3 1993
梦如初夏
梦如初夏 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:01

    It's because you are using go between the statement that declares the variable and the statement that uses it.

    The go command is not an SQL command, it's a separator between sessions in Management Studio. Just remove all the go commands in your query, and you can use the variable all the way.

提交回复
热议问题