6

I have a SQL Server 2008 Database Project that I'm attempting to deploy using Visual Studio 2010. When I click deploy, the build works fine, but after it creates the deployment script and begins to execute it, I get the following errors:

Error 8 SQL80001: 'DatabaseName' is not a recognized option.

Error 7 SQL80001: Incorrect syntax near ':'.

Looking at the deployment script, it has the following lines:

:setvar DatabaseName "DEV_DB"

...

GO

:on error exit

So it looks like SQL Server is not running the deployment script in SQLCMD mode to understand that syntax. If I'm copying and pasting into SSMS, I can set that option, but I want to deploy straight from Visual Studio. Where is the setting to have VS run this script in SQLCMD mode OR How can I set the script to not generate using SQLCMD syntax?

Thanks.

4
  • Just to clarify, are you running the generated SQLCMD script interactively (i.e. through the VS query window) or is the Deploy step doing this for you? Commented Sep 14, 2012 at 2:52
  • It's running as part of the deployment. When I click Deploy, I believe it's generating the SQL script and deploying it in the same step. Commented Sep 15, 2012 at 23:23
  • That's odd. If you create a new db project from scratch, do you get the same error or does it only happen with this particular project? Commented Sep 19, 2012 at 16:06
  • 1
    possible duplicate of Is it possible to make SQLCMD Mode 'Sticky' in Database Projects Commented Apr 9, 2015 at 9:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.