As a DBA consultant, I have a lot of scripts stored on my laptop. Today I noticed something annoying…
I had to open a lot of my scripts and every time I double clicked on a .sql file, a new management studio opened.
At some point, there were more than 10 management studio’s open, all consuming memory on my laptop…
Isn’t it possible to open all the queries in just one management studio?
Well actually, it is. After searching the internet I found out that there is some registry changing involved.
Open the registry editor (regedit) and search for the following key
The default key is as follows “C:Program Files (x86)Microsoft SQL Server110ToolsBinnManagementStudiossms.exe” /dde
Please note that I have used a default installation. It might be that your default key is different than this one.
You have to add a parameter “%1” to the default key. %1 indicates the file that you want to open.
Your default key should look similar like this one:
“C:Program Files (x86)Microsoft SQL Server110ToolsBinnManagementStudiossms.exe” “%1” /dde
Normally, when you open 2 SQL files now, they should be opened in the same management studio. But… on my laptop… it didn’t… L
So, I figured out I had to change a second registry key
The default key was set to sql_auto_file
When I searched for that registry key, I saw that the open command key was set to open Notepad.
To solve this, I changed the default key of the registry entry .sql into ssms.sql.11.0
When you open 2 (or more) SQL files now, they should be opened in the same management studio.