This is a very common scenario for database projects created in Visual Studio:
However, if you try to run this file from SQL Management Studio, it will result in errors.
This is because the script contains some sqlcmdvars (:setvar) which are specific to SQLCMD. If you run the same script using sqlcmd.exe, it would work fine.
If you want to run it from SQL Management Studio, click Query->SQLCMD Mode and then execute the query.
- Create a database project
- Right click the project and select Properties
- Set "Deploy action" to "Create a deployment script (.sql)
- Right click the project and select Deploy
However, if you try to run this file from SQL Management Studio, it will result in errors.
This is because the script contains some sqlcmdvars (:setvar) which are specific to SQLCMD. If you run the same script using sqlcmd.exe, it would work fine.
If you want to run it from SQL Management Studio, click Query->SQLCMD Mode and then execute the query.
Brilliant - I spent all day looking for a way to run VS2010 deployment scripts in Management Studio. Kicked myself when I saw how easy it was
ReplyDeleteThanks so much for this post. Saved me a lot of work.
ReplyDelete