Visual Studio Database Deployment - Script not running in SQLCMD mode
Asked Answered
P

0

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.

Plugboard answered 11/9, 2012 at 17:24 Comment(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?Arte
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.Plugboard
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?Arte
possible duplicate of Is it possible to make SQLCMD Mode 'Sticky' in Database ProjectsChatterton

© 2022 - 2024 — McMap. All rights reserved.