Sql Commands in a Visual Studio Transact SQL Script

Enabling SQLCMD in a Visual Studio Transact SQL Script

So it’s pretty simple but, for some reason, the posts on MSDN that I initially read didn’t include this small but immensely important step.  So, if you, like me, have added some SQLCMD statements to your pre or post deployment script, Visual Studio will likely have greeted you with:

SQL80001: Incorrect syntax near ‘:’.

Here’s how to overcome this:

From the SQL Menu

  1. Expand Execution Settings
  2. Select SQLCMD Mode

From the Transact SQL Editor

  1. Right click anywhere in the editor
  2. Select SQLCMD Mode

Leave a Reply

Your email address will not be published. Required fields are marked *