sqlcmdazure-data-studio

Enable SQLCMD mode in Azure Data Studio


Is there any way to set SQLCMD mode in Azure Data Studio? I'm currently running 1.46.1.

The Azure Data Studio - Overview page in MS Learn shows that Azure Data Studio supports SQLCMD in the Query Editor. However, I cannot see any way to enable SQLCMD mode, any menu item or button that would do it. I did see an old blog post from September 2019 which showed a button to the right of the Database dropdown at the top of the Query Editor. However, I cannot see that button in my version of Azure Data Studio (it's seemingly been replaced by the Estimated Plan and Enable Actual Plan buttons). I also cannot find any Keyboard Shortcuts or Extensions related to SQLCMD.

EDIT: These are the buttons I see at the top of the Query Editor window: buttons visible at top of Query Editor window

They're different from those in @ThomA's screenshot in the comments. As far as I can see, though, there isn't an obvious option to enable the SQMCMD mode button.


Solution

  • Found it: I needed to enable preview features. The SQLCMD release announcement was over 3 years ago so it never occurred to me SQLCMD would still be in preview 3 years later.

    To enable preview features:

    1. Press Ctrl+, to bring up the Settings;
    2. In the settings search box enter enable unreleased. ADS should display one result: Enable unreleased preview features;
    3. Tick the Enable unreleased preview features checkbox.

    If you go back to the Query Editor you should now see the Enable SQLCMD button:

    "Enable SQLCMD" button visible in Query Editor