Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make SQLCMD Mode 'Sticky' in Database Projects

Tags:

I have a database project in Visual Studio 2013, with a post deployment script that uses SQLCMD mode.

The problem I am having is that the project defaults to non-SQLCMD mode every time the project is opened. This means that every time the project is opened, the Error List will be flooded with errors like "Incorrect syntax near ':'." until the developer opens the deployment script and clicks the SQLCMD Mode button.

Is there a way to default to keeping SQLCMD Mode on so developers don't have to do this each time they open the project?

like image 529
Andrew Keller Avatar asked Feb 27 '14 02:02

Andrew Keller


People also ask

How to enable SQLCMD mode in Visual Studio?

Enable SQLCMD Scripting by Default To turn SQLCMD scripting on by default, on the Tools menu select Options, expand Query Execution, and SQL Server, click the General page, and then check the By default open new queries in SQLCMD Mode box.

What is Sqlproj?

Database development project created by Visual Studio, a Windows software development IDE; stores the schema of the database and can include SQL source code; used for creating databases for SQL Server, Microsoft's relational database management system (RDBMS) software. Older .


1 Answers

Had to dig a little for this one:

Go to the Tools|Options menu, then expand to SQL Server Tools, Transact-SQL editor, Query Execution. There's a setting in there to click that says "By default, open new queries in SQLCMD mode".

However, this shouldn't throw any errors/warnings unless you have that particular script open unless there's something new in VS2013 that changes that behavior.

This looks like a local option so would need to be set for each developer.

like image 177
Peter Schott Avatar answered Oct 27 '22 21:10

Peter Schott