I’ve written in the past about some of the ways you can configure SQL Server Management Studio to help you make your life a bit easier. I’ve discovered two more little tricks I thought I’d pass along.
Every DBA has a handful or more of T-SQL scripts they use on a regular basis to make their job easier. They could be code snippets to get some information from a server or database or to create a new user or something else that is done fairly frequently. I typically store my snippets in text files in a folder on my hard drive and leave Windows Explorer open to that folder and open the files as need and copy and paste the contents into SSMS. There’s a better way and it’s called Solution Explorer. I never really gave it a second thought because it never opened by default and I never looked for it. It’s a handy tool for keeping all your bits of SQL code handy.
You can bring it up by typing Ctrl-Alt-L in SSMS or going to View –> Solution Explorer. If you right click, then choose Add –> New Solution, you’ll get three default folders titled Connections, Queries, and Miscellaneous. You can then drag your T-SQL script files from Windows Explorer into this pane. If your files have a .sql extension, they will show up in the Queries folder, otherwise they will drop into the Miscellaneous folder. Now, you can double-click on these icons from within SSMS to automagically load the script into a new query window.
The second tip is regarding command line options for starting SSMS. If you just start SSMS normally, the solution file you created will not be loaded. But you can have SSMS load this file on startup by simply adding a path to the file on the command line. You can also get rid of the SSMS splash screen by including the -nosplash option. Putting these altogether, my startup shortcut to starting SSMS looks like this:
“C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe” “C:\Users\shastuart\Documents\SQL Server Management Studio\Projects\Utility Scripts.ssmssln” -nosplash
Now go forth and be more productive!