microsoft / vscode-mssql

Visual Studio Code SQL Server extension.
Other
1.53k stars 457 forks source link

Support SQLCMD mode #599

Closed sidewinder94 closed 5 years ago

sidewinder94 commented 7 years ago

Would it be possible to implement a SQLCMD mode for executing SQL scripts ?

As of now, the syntax is not recognized by VSCode and the execution fails if using SQLCMD features.

kzhui125 commented 6 years ago

please support syntax first, thanks image

estenrye commented 6 years ago

Also would like to see the syntax updated to support SQLCMD issue

OsirisDBA commented 6 years ago

This isnt a full replacement for ssms until sqlcmd mode is supported unfortunately. But great work so far.

tlagrone commented 5 years ago

1up

Carthorn commented 5 years ago

1up :)

lwohlhart commented 5 years ago

1up

choo75 commented 5 years ago

1up :)

datamc-pdetomasi commented 5 years ago

1up

verschaevesiebe commented 5 years ago

1up

raviktech11 commented 5 years ago

1up

abist commented 5 years ago

The new version now supports SQLCMD!

puruzio commented 4 years ago

Which version supports this? I'm using 1.40.10, October 2019 build but it still says ":setvar" is incorrect syntax.

sidewinder94 commented 4 years ago

@puruzio There is an "SQLCMD: Off" button that was added in the latest version, if you click on it it will enable the SQLCMD syntax & ability to run. Otherwise, it won't recognize the SQLCMD syntax.

puruzio commented 4 years ago

Sorry, where can I find that button? I looked all over but couldn't find it.

abist commented 4 years ago

@puruzio You can either access it via the command palette (Ctrl/Cmd + Shift + P) then look for SQLCMD or it's in the lower most bar when a query editor is opened.

puruzio commented 4 years ago

Sorry. Nothing under Ctrl/Cmd+SHift+P shows SQLCMD in its description. I checked in on both Mac OS and Windows versions of VS Code v1.40.0. What am I missing?

abist commented 4 years ago

@puruzio What version of the extension are you using? We introduced SQLCMD in version 1.7.0

puruzio commented 4 years ago

1.7.0 :(

puruzio commented 4 years ago

Never mind. I found it in the lower right corner of the task bar. Thanks!

puruzio commented 4 years ago

Just one more question. VS code still highlights ":setvar" as a syntax error even with SQLCMD:On. Is there a solution for that?

It seems to execute and format the code just fine. But the error message is annoying.

Zarepheth commented 6 months ago

SQLCMD On/Off is only available while VS Code is connected to a database. Otherwise, it is hidden.

datamc-pdetomasi commented 5 months ago

@Zarepheth thanks for pointing that out, I have found the SQLCMD option after years of being annoyed by this issue.

Devs Is it possible to enable the SQLCMD mode regardless of the database connection as most of the time I use VSCode to open my repository of files and not to run them in VSCode directly. The syntax highlighting / problems being accurate despite a connection would be wonderful