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.
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.
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
Select SQL Server Scripts. Give the name to the solution and define the location where you want to store the file as shown below.
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.
Right click on solution explorer and create new project as shown below.
Write a project name. I am giving a name SalesProject to this project as shown below
Right click Connection in Solution Explorer under SalesProject and create new connection as shown below.
Choose the server name and type Authentication Information as shown below. You can also create multiple connections within connection option.
Now right click Queries in Solution Explorer under SalesProject and create new query file as shown below.
You can also choose Add Existing Item from the Project menu to include existing SQL Scripts into your project as shown below.
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.
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.
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…
I am sure this article has touched all the
internet users, its really really nice post
Your means of telling everything in this post is genuinely fastidious, all be capable of
without difficulty understand it, Thanks a lot.
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.