Share via


How to: Enable SQLCMD mode in the Transact-SQL Editor

The Transact-SQL editor can support the use of many SQLCMD commands in your scripts. You can toggle whether SQLCMD commands are executed or ignored. If you execute a script that contains SQLCMD commands when SQLCMD mode is off, a syntax error results. For more information about how to start the editor, see How to: Start the Transact-SQL Editor.

To toggle SQLCMD mode from the Data menu

  1. Open the query in the Transact-SQL editor.

  2. On the Data menu, point to Transact-SQL Editor, and click SQLCMD Mode.

To toggle SQLCMD mode from the toolbar

  1. Open the query in the Transact-SQL editor.

  2. On the Transact-SQL Editor toolbar, click SQLCMD Mode.

To toggle SQLCMD mode from the shortcut menu

  1. Open the query in the Transact-SQL editor.

  2. Right-click anywhere in the editor window, and then click SQLCMD Mode.

See Also

Tasks

How to: Execute a Query

Concepts

Editing SQLCMD Scripts in the Transact-SQL Editor

Query Results Overview