microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.51k stars 883 forks source link

SQLCMD mode fails to parse some sqlcmd keywords #7381

Open udeeshagautam opened 4 years ago

udeeshagautam commented 4 years ago

Azure Data Studio Version: Version: 1.11.0 (user setup) Commit: acc85c2c23f4889b4ae9373282d92daec321b1bd Date: 2019-09-03T23:55:40.484Z VS Code 1.37.0 Electron: 4.2.9 Chrome: 69.0.3497.128 Node.js: 10.11.0 V8: 6.9.427.31-electron.0 OS: Windows_NT x64 10.0.18362

There are some sqlcmd keywords not being handled by Batch Parser and need specific handling. SSMS handles them seperately and ADS does not have that capability. This list includes :Connect :Error :Exit :On Error :Out :Quit :!!

Steps to Reproduce:

  1. Open Query editor and switch on SQLCMD Mode
  2. Run a query like

:Connect localhost

Use Database1 Go

Select * from Table1

Errors out saying, Execution failed due to an unexpected error: SQL Execution error: A fatal error occurred. Incorrect syntax was encountered while :Connect was being parsed.

Which it works correctly in SSDT and SSMS.

art-ist commented 1 year ago

Any news on this for 2022?