By Mark Wojciechowicz, Anexinet Business Intelligence Architect
I recently learned about a feature in SSMS that I never paid much attention to – the ability to save queries in a solution. I normally organize my queries into folders in the project folder for short term use with the project that I am working on. However, I found that the solution method of storing queries could prove very useful for the ones that you use on a regular basis.
First off, this is what it looks like:
To access the solution panel, Go to view> Solution Explorer (or CTLR + ALT + L)
To add a project, right click on the solution explorer and add new project. Right click on the Connections folder to add a new connection (Use the options tab to specify a database. You can add a new query by double—licking the connection or by right clicking on the Queries folder.
Note that when you rename a query it must end in .sql or the file will be moved under the miscellaneous folder. To run a query, simply double click it and it will open it up in ssms.
This is a nice way to organize your queries and easily find them (rather than hunting through windows explorer). There is also source control support for this solution, though I have not tested that as of yet.