Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run the VS2010 Sql Server project's deployment script

I'm confused, if I select the "Create a deployment script" option and 'deploy' the project, i get a SQL file that uses non-SQL syntax for variables like $database.

How can I execute that deployment script? I'm pretty sure SQL Server management Studio doesn't understand the syntax.

It seems to me the only way to actually deploy, is to swith the option to "Create a deployment script and deploy to the database"

like image 354
Michiel van Oosterhout Avatar asked Sep 28 '10 15:09

Michiel van Oosterhout


People also ask

How do I run a SQL Server script?

Click Query > Connection > Connect to connect to the server that contains the database you want to access. Select the appropriate StarTeam Server database. Open the tuning script, by choosing File > Open > foldername\scriptname. Execute the script, by clicking the Execute button on the toolbar or by pressing F5.

How do I run a SQL script in management studio?

Open SQL Server Management Studio > File > Open > File > Choose your . sql file (the one that contains your script) > Press Open > the file will be opened within SQL Server Management Studio, Now all what you need to do is to press Execute button.

How do I run a .SQL File in Visual Studio?

In Visual Studio Code, press Ctrl+Shift+P (or F1) to open the Command Palette. Select MS SQL:Connect and choose Enter.


1 Answers

The script that is generated by Visual Studio is not a standard T-SQL script. It is a SQLCMD script. SQL Server Management Studio does allow you to execute SQLCMD scripts, but by default it is disabled. This link explains more details on SQLCMD mode and how to enable it.

like image 82
Dave Frautnick Avatar answered Sep 28 '22 10:09

Dave Frautnick