Search code examples
sql-serverssmssqlcmd

SQLCMD Mode in SSMS


I've started getting into the habit of switching to SQLCMD mode in SQL Server Management Studio when I'm deploying batches of SQL. I'm doing this so I can preface the SQL with

:on error exit

I've forgotten to do this once and it took me a few minutes to clean up because some SQL had been run and there had been an error. I know I can set SQLCMD to be on by default, but my question is:

Is there any downside to setting SQLCMD Mode on by default? Do I lose any functionality in SSMS?


Update 20190321: I've been using SQL CMD Mode for about 9 months now and haven't experienced any issues with it.


Solution

  • The documentation from Microsoft states:

    Enabling SQLCMD mode turns off IntelliSense and the Transact-SQL debugger in the Database Engine Query Editor.

    I did find this question which was pretty relevant and helped provide some insight.

    I'm going to enable it by default. The Intellisense in SSMS is a joke and I don't see the value in debugging SQL line by line when writing set based code.

    Update 20190409 I did find that collapsible regions don't work in SQLCMD Mode; not a huge issue for me, but that might impact others' desire to use this feature.