Bug Description
Repro steps
- Add an empty line between scalar/table variable and the query.
- Select entire query as context and execute.
Ex.
DECLARE @year INT = 2024;
DECLARE @table TABLE (Brand NVARCHAR(255));
INSERT INTO @table
SELECT Brand
FROM dbo.cars
WHERE Year = @year
The above query fails because of the empty line between the variable declaration and the insert statement (used to work before).
Getting rid of the space or adding a comment appears appears to fix the issue.
Issue started when upgraded from 1.17.29 -> 1.17.30
Expected Behavior
The query should run if i select the entire statement, i.e. the variables should be in the context regardless of white space between them and the statement
Actual Behavior
Scalar and table variables not found in the execution context.
Environment
- DBCode version: 1.17.37
- VS Code (or fork) version: 1.106.0
- OS: MacOS Tahoe 26.1
- Database: MSSQL
- Connection: (direct/SSH/SSL)
Error Meesages (if applicable)
Must declare the scalar variable "@Year".