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

前端 未结 8 1091
梦毁少年i
梦毁少年i 2020-12-09 16:44

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 op

相关标签:
8条回答
  • 2020-12-09 17:07

    It does it on my WinXP box too...

    I agree with Josh Yeager, but I went into Control Panel > Folder Options > File Types tab and did it there.

    1. Scroll down to SQL extension
    2. Click Advanced button
    3. Select "Open" from the Actions box
    4. Select "Edit.."

    Funny thing is, my "DDE MEssage" box already had a "%1" in there, but it wasn't in the Regedit value. Clicking "OK" out of everything updated the appropriate key(s) and while this is a lot of clicks, it's a better habit to get into than poking around in the registry. Fat-fingered people can get into a lot of trouble in a registry...(that's me, BTW :-D)

    Oh, and like Herb Caudill pointed out, the "/dde" needs to be in the regkey but again, using the Folder Options area will handle the appropriate entries.

    0 讨论(0)
  • 2020-12-09 17:09

    In my case the registry key that needed fixing was HKEY_CLASSES_ROOT\.sql

    The (Default) had been changed to sql_auto_file... and needed to be ssms.sql.12.0 (for SSMS 2014)... presumably ssms.sql.11.0 for SSMS 2012.

    All the other stuff down in the HKEY_CLASSES_ROOT\ssms.sql.12.0 path, that most other solutions tend to refer to, was fine as is.

    screenshot of proper reg entry

    0 讨论(0)
  • 2020-12-09 17:13

    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"
    0 讨论(0)
  • 2020-12-09 17:16

    I tried all the ideas above (registry entries, etc.) - no luck. What ended up fixing it for me was this:

    1. close all SSMS instances.
    2. right click on a .sql file and select "Open With..." > "Choose Default Program"
    3. Select Notepad
    4. Double click on the file - it should open in notepad.
    5. close notepad.
    6. right click the .sql file again and select "Open With..." > "Choose Default Program" 
    7. Select "Sql Management Studio" again.
    8. Click the .sql file it should open SSMS
    9. Subsequent .sql files should open in the same instance.
    

    Hope this helps :)

    0 讨论(0)
  • 2020-12-09 17:16

    Have you installed the latest relevant SQL Server service pack?

    SQL Server 2005 and 2008 need patched on Windows 7. This article is about express but the same "fix" should apply. It's common for each new MS OS.

    Generally, you always have your client tools at the same build as your server installs anyway.

    0 讨论(0)
  • 2020-12-09 17:18

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell]

    [HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open]

    [HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command] @="\"c:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\sqlwb.exe\" /dde"

    [HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\ddeexec] @="Open(\"%1\")"

    [HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\ddeexec\application] @="sqlwb.9.0"

    [HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\ddeexec\topic] @="system"

    0 讨论(0)
提交回复
热议问题