#1072 Issue with variables?


Using SQuirreL on Windows 7 x64 to connect to a Windows 2003 Server running IIS and SQL Server 2005.
I have Auto-Commit toggled off. (Not sure what other settings might matter.)

I tried testing a batch of SQL commands, and it always failed with errors along the lines of:
Must declare the scalar variable "@VarName".
SQLState: S0002
ErrorCode: 137

Didn't matter which variable, or what I assigned to it, or what datatype it was.
Eventually I pared the SQL down while troubleshooting to something like the following:
DECLARE @sqlVar AS int;
@sqlVar = '1';
SELECT @sqlVar;

I finally ran the entire set of commands from Visual Studio's SQL Server management (available on the server directly), and it ran without a problem; same for placing the SQL directly into the ASP page. It's in use and functional as we speak.

Remove the variables and plug in literal values to replace the variables, Squirrel handles the commands just fine.

Also, one other quirk I noticed: I had 2 variable declarations. If I deleted the datatype portion (i.e. remove AS int), the SQL wouldn't run; BUT after hitting undo, the script would run once (unsuccessfully, because the data in the table never updated and certain SELECT test commands at the end never executed). It would not announce any errors or failures anyway. The errors returned for any runs thereafter.

Thank you, and sorry to bother you if this is something about usage of Squirrel that I am ignorant of. Still learning lots about web development.