Sunday, January 5, 2014

What is a SQL Server Managment Studio project and how to create one?

SQL Server Management Studio provides a means to group together all your codes in one place as part of a SQL Server Project. A solution is a container for a project(s) containing all logically related scripts and files in one place. It is available even in SQL Server 2012 Express. This is the platform to use if you want to develop scripts for Database Engine and Analysis Services.

A solution explorer is a pane in SQL Server Management Studio with project containers for managing scripts and files. The concept of Solutions and Projects in Visual Studio is too well known requiring elaboration and this is carried over to SSMS and in fact SQL Server is tightly coupled with Visual Studio. In Visual Studio you can carry a lotsof things that you do in SSMS

How to display Solution Explorer in SQL Server Management Studio?

  • Click File | New | Project... in SSMS to open the New Project window of Visual Studio as shown.


  •  If you choose SQL Server Management Studio Solution then the above interface adds a Blank Solution to which you may add projects. On the other hand
    If you choose SQL Server Management Studio projects then you have the option of adding a SQL Server scripts project or a Analysis Services scripts project as shown.


  • When you accept the option of creating a SQL Serverscripts project Visual Studio creates a Solution and a project within the solution as shown. The Project has folders for Connections, Queries and Miscellaneous scripts.  The default location of the project is at (generally at the logged in Users folder): 
c:\users\mysorian\documents\sql server management studio\Dec2013\Dec2013\Dec2013.ssmssqlproj 


The properties of the solutions shows where the source code is located.


  • From the Solution node you can create a new project or add an existing project to it.

    From the project node (right click) you can add New Item, or an existing item, or a new query, or a new connection.
When you click add New Item, the VS interface is displayed as shown,

  • You can start off with any of the templates to create a query. 

You can open the same project using File | Open |Project/Solution... in SSMS as shown here.


This displays the  Solution explorer as shown by accessing the Source saved on SSMS as shown.


Now you will be developing the project in SQL Server Management Studio.

You can do it both ways or in mixed mode.