SQL Server

What is the advantage of creating solution and how to create solution by using SQL Server Management Studio (SSMS)

When you need to open any SQL script file (which has .SQL extension)  in SSMS then you will go to File  -> Open -> File option in SSMS as shown in figure below and then browse a SQL script file to open in SSMS as shown in the image below.

 

open-file-in-ssms

 

Now if you want to open 50 script files then 50 times you need to go to File  -> Open -> File option in SSMS and 50 times you need to browse the SQL script file to open those files  in SSMS.

But if you create a solution in SSMS then all the files will be available in solution explorer and then you double click on any file to open in SSMS as shown in the figure below.

 

Solution-SQL-Server-2

 

This is the advantage of creating solution files that all the sql script files will be available in the solution explorer and you just need to double click the desired script file .

One solution file contains multiple projects. It means you can logically divide the scripts according to different tasks. For example you can put the scripts related to Sales, HR, and Finance in the Sales Project, HR Project and Finance Project respectively.

Also one project file has three sections

  • Connection –It stores connection information like Login Name and Password. You can also add multiple connections into a project
  • Queries- It is used to store the script files which has .SQL extension of the project
  • Miscellaneous- You can store help files or coding guidelines files of your company.

 

Next I will write the steps to create a solution file using SSMS.

Open SSMS . Go to File -> New -> Project as shown below

 

open-project-in-ssms-1

 

Select SQL Server Scripts. Give the name to the solution and define the location where you want to store the file as shown below.

 

sql-server-scripts-in-ssms-2

 

Now to go solution explorer, this will appear on the right hand side of SSMS.

If it does not then either go to View under the menu options of SSMS and choose Solution Explorer or Press Ctrl+Alt+L ,this is the shortcut for solution explorer.

Under solution explorer one project appears which has the same name as that of solution. If you don’t want that name then right click on the project and remove it as shown below.

 

remove-project-from-solution-in-ssms-3

 

Right click on solution explorer and create new project as shown below.

 

add-new-project-in-ssms-4

 

Write a project name. I am giving a name SalesProject to this project as shown below

 

add-new-project-in-ssms-5

 

Right click Connection in Solution Explorer under SalesProject and create new connection as shown below.

 

add-new-connection-in-ssms-6

 

Choose the server name and type Authentication Information as shown below. You can also create multiple connections within connection option.

 

storing-connection-information-in-solution-7

 

Now right click Queries in Solution Explorer under SalesProject and create new query file as shown below.

 

adding-script-files-in-solution-8

 

You can also choose Add Existing Item from the Project menu to include existing SQL Scripts into your project as shown below.

 

add-existing-scripts-in-solution-file-9

 

Similarly you can import existing text files into Miscellaneous folder. But there is a shortcut as well which I have shown in the figure below.I have directly dragged and dropped the word file into Miscellaneous folder.

 

adding-miscellaneous-in-solution-file-ssms-10

5 thoughts on “What is the advantage of creating solution and how to create solution by using SQL Server Management Studio (SSMS)

  1. I have read some good stuff here. Definitely worth bookmarking
    for revisiting. I surprise how much attempt you place to create this type of
    excellent informative site.

  2. I needed to thank you for this wonderful read!! I absolutely enjoyed every little
    bit of it. I’ve got you book-marked to look at new stuff you post…

  3. Your means of telling everything in this post is genuinely fastidious, all be capable of
    without difficulty understand it, Thanks a lot.

  4. An impressive share! I’ve just forwarded this onto a co-worker who has been conducting a little
    homework on this. And he in fact bought me breakfast simply because I discovered it for him…
    lol. So allow me to reword this…. Thanks for the meal!!
    But yeah, thanks for spending time to talk about this subject here on your web page.

Leave a Reply