snippetsqlModerate
How to prevent SQL files opening new instances of SSMS 17.9.1?
Viewed 0 times
preventssmsnewinstancessqlfileshowopening
Problem
Synopsis
This is not a new problem and there are several solutions floating around on Internet.
Problem
When you double click on a
What I tried
Workarounds
Yes, I know about these workarounds:
I am not looking for workarounds.
My environment
Even with the new SSMS 17.9.1 (build: 14.0.17289.0), I am still pointing to SQL Server 2016 (13.0.5233.0). Previously, I was using SSMS June 2016 (build: 13.0.15000.23) with the same SQL Server (13.0.5233.0).
Because of permission, I am not running any application as administrator.
SQL Server versions are listed here.
SQL Server Management Studio versions are listed here.
This is not a new problem and there are several solutions floating around on Internet.
Problem
When you double click on a
.sql file, a new instance of SSMS is opened. I did not have this problem until new SQL Server Management Studio (SSMS 17.9.1) was installed.What I tried
- This page lists several solutions suggesting registry changes and file associations, and reinstalling SSMS. None worked.
- This one has almost the same as the previous link. (SO is so much better than those forums.)
- Registry changes are shown here with excellent screenshots. I added
"%1"but that did not make any difference.
- The suggestion mentioned on SO did not work either.
- On DBA, it is mostly talking about raised permissions, which is not the case with my situation.
Workarounds
Yes, I know about these workarounds:
- Ctrl + O
- Drag
.sqlfiles to SSMS
I am not looking for workarounds.
My environment
Even with the new SSMS 17.9.1 (build: 14.0.17289.0), I am still pointing to SQL Server 2016 (13.0.5233.0). Previously, I was using SSMS June 2016 (build: 13.0.15000.23) with the same SQL Server (13.0.5233.0).
Because of permission, I am not running any application as administrator.
SQL Server versions are listed here.
SQL Server Management Studio versions are listed here.
Solution
I have encountered this issue after installing SSMS 18 instead of 17.9. Then I have tried solutions from the list above but none worked. Uninstalling SSMS 18 and installing 17.9 again did not work either. I was finally able to resolve this issue with SSMS 18, but I hope it will fix incorrect behavior of SSMS 17 as well. First of all I've uninstalled SSMS, then I've searched through registry to find and remove all meaningful nodes containing info about SSMS or sql_auto_file. I removed the following nodes (don't forget to backup each of them prior to deleting!):
Then I've restarted my PC, then installed SSMS 18, then restarted again. After that SSMS opens sql files in existing SSMS instance and explorer has correct file icon assigned (document with small database icon)
- HKEY_CLASSES_ROOT.sql
- HKEY_CLASSES_ROOT\Applications\Ssms.exe
- HKEY_CLASSES_ROOT\sql_auto_file
- HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio
- Removed all records for ssms in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.sql
- HKEY_USERS.DEFAULT\Software\Microsoft\SQL Server Management Studio
Then I've restarted my PC, then installed SSMS 18, then restarted again. After that SSMS opens sql files in existing SSMS instance and explorer has correct file icon assigned (document with small database icon)
Context
StackExchange Database Administrators Q#234564, answer score: 13
Revisions (0)
No revisions yet.