SSMS Tips and Tricks 4-9: Setting SQLCMD mode for all new query windows
SQLCMD mode changes how queries are executed in SSMS. When using this mode, you can work with options that aren’t normally part of SQL Server T-SQL scripts.
Some installation scripts also require SQLCMD mode and will fail if it’s not enabled.
Let’s look at an example executing a query against 2 servers within the same script.
First, we open a new query window, then on the Query menu, we choose SQLCMD Mode.
2025-08-15

