How to open multiple SQL files in one SQL Server Management Studio

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.


5 comments on “How to open multiple SQL files in one SQL Server Management Studio
  1. Windows 7 Pro x64
    SSMS ver 11.0.3128

    Still not working after making recommended registry changes :(

    • I was working with Windows 8.1 but according to me, the same settings should also work on Windows 7.
      Can you change the default program of .sql files to notepad for example and then change it back to SSMS.
      It might work.


  2. Changing everything and then changing again .sql files to .txt and back to SSMS did work.

    Thank you Pieter.

  3. This worked for me as well but as RZS stated I had to change the default file to notepad then back to opening with ssms and it worked. I really appreciate the guide.

  4. The solution worked for me. I have SQL Server 2014, which translates to ssms.sql.12.0 and I used the suggested registry changes and it solved the issue of opening a new SSMS whenever I double-clicked on a .sql file. Now it opens within the same open SSMS. Thank you.

Leave a Reply to Ken Cancel reply

Your email address will not be published. Required fields are marked *