Database projects: Visual Studio 2008 vs 2010

I just installed VS 2010 to run another DB project that was created using 2010. In VS 2008 I was able to right click on the SQL file and select "Run ON" to run a script on the given SQL Server. I don't see this option in 2010. Is it available and if so how can I access it?

+2


a source to share


2 answers


The database project format that was included in VS 2005 and VS 2008 was completely removed in 2010.

Instead of keeping free SQL files that can be run independently, it acts more like a compiler. When the project is built, the SQL files are processed and (for the most part) turned into an XML description of the database schema.

If you are trying to create or update a database based on all scripts in a project, right-click the project name in Solution Explorer and select Properties. In the Deployment tab, you will replace Deploy Action with Create a deployment script and deploy to database. Specify connection settings and database name.

When you select Deploy from the context menu of the context menu of a database project, Visual Studio will create the database deployment files and generate the database. He is usually smart enough to update existing databases, assuming the project was well designed.



If you're trying to deploy remotely to a production SQL Server, things get a little more complicated. There is no single set of SQL files that you can run - part of the database schema is stored as XML.

Take a look at http://blogs.msdn.com/b/gertd/archive/2009/06/05/declarative-database-development.aspx - it describes how to use the "vsdbcmd.exe" utility to deploy a database file.

If you just want to run a single SQL file or test part of it, open the file, right click and select "Execute SQL"

+1


a source


DNRTv # 167 talks about VS 2010 projects in detail.



As @ShadowChaser mentioned, the DB project in VS 2008 just had scripts in it, and the 2010 version is much more complex and has a lot more features.

0


a source







All Articles