Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

SQL DECLARE not retaining scope when running multiple statement

$
0
0

Hi, I have an issue when running multiple SQL statements through IDEA:

 

DECLARE @x int

SELECT * FROM MyTable WHERE id = @x

go

 

 

DECLARE @y varchar(max)

SELECT * FROM MyTable WHERE name = @y

go

 

 

...in this situation, the console spits out an error - @x is not declared. But if i run the scripts (between the go's) one by one it works fine.

How can I get this to work for the whole script?

~gilbert



Viewing all articles
Browse latest Browse all 5661

Trending Articles