Cannot execute script with variable declarations
- Dominant language
- Java
- Stars
- 51.8k
- Forks
- 4.4k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 188
Description
### Description
When I have a script (batch) for SQL Server that contains variable declaration
```
DECLARE @month DATETIME = '2026-03-01';
SELECT @month;
```
I can execute it by selecting everything with CTRL+A and then issuing CTRL+Enter but this is not optimal (too much hassle having to select everything every time). So I have tried the option Execute SQL Script (ALT+X) but this gives error:
```
Error occurred during SQL query execution
SQL Error [137] [S0002]: Must declare the scalar variable "@month".
Must declare the scalar variable "@month".
```
### DBeaver Version
Community Edition 26.0.1
### Operating System
Windows 11
### Database and driver
com.microsoft.sqlserver.jdbc.SQLServerDriver 13.2.1.jre11
### Steps to reproduce
Create script
```
DECLARE @month DATETIME = '2026-03-01';
SELECT @month;
```
Issue ALT+X
### Additional context
Contributor guide
Assessment
This issue has not been assessed yet.