SQL Management Studio won't open scripts on double-click

Viewed 23920

I'm used to double-clicking *.sql script files to open them in SQL Server Management Studio. I recently upgraded to Win7, and now when I double-click a script file, SSMS opens with an empty environment. I can then use File/Open or File/Recent Files to open my script, but I would much prefer for it to just open whatever I double-clicked on like a normal application would.

Any ideas what's going on?

BTW when I double-click a script from the Solution Explorer in Visual Studio, it does open it automatically just like you would expect.

8 Answers

I had the same problem. I don't know what caused it, but I fixed it with a quick Registry hack.

  1. Go to HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command
  2. Edit the (Default) value
  3. It should contain something like this: "c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe" /dde
  4. Add "%1" to the end
  5. The final value will be something like this: "c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe" /dde "%1"

For SQL Server 2012 the reg key is different:

HKEY_CLASSES_ROOT\ssms.sql.11.0

Run regedit and go to the following key:

Check to make sure you have tthe correct version. In my case, it is 12.0

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssms.sql.12.0\Shell\Open\Command

Edit the default value to add "%1" to the end.

The value should now look like the following: (modify path name to to match the ssms.exe program on your pc)

"c:\Program Files\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\ssms.exe" /dde "%1"

Related