SQL Management Studio 双击时无法打开脚本
我习惯双击 *.sql 脚本文件在 SQL Server Management Studio 中打开它们。我最近升级到 Win7,现在当我双击脚本文件时,SSMS 将打开一个空环境。然后,我可以使用“文件/打开”或“文件/最近的文件”来打开我的脚本,但我更希望它像普通应用程序一样打开我双击的任何内容。
有什么想法吗?
顺便说一句,当我在 Visual Studio 中的解决方案资源管理器中双击脚本时,它会像您期望的那样自动打开它。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我也有同样的问题。我不知道是什么原因造成的,但我通过快速注册表破解修复了它。
"c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn \VSShell\Common7\IDE\ssms.exe" /dde
"%1"
添加到末尾"c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe" /dde "%1"
I had the same problem. I don't know what caused it, but I fixed it with a quick Registry hack.
"c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe" /dde
"%1"
to the end"c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe" /dde "%1"
就我而言,需要修复的注册表项是 HKEY_CLASSES_ROOT\.sql
(默认)已更改为 sql_auto_file...并且需要为 ssms.sql.12.0(对于 SSMS 2014)...大概是 ssms.sql.11.0 SSMS 2012。
HKEY_CLASSES_ROOT\ssms.sql.12.0 路径中的所有其他内容(大多数其他解决方案倾向于引用)都很好。
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.
我尝试了上面的所有想法(注册表项等) - 没有运气。
最终为我解决的问题是:
希望这有帮助:)
I tried all the ideas above (registry entries, etc.) - no luck.
What ended up fixing it for me was this:
Hope this helps :)
对于 SQL Server 2012,reg 密钥有所不同:
For SQL Server 2012 the reg key is different:
它也在我的 WinXP 机器上执行此操作...
我同意 Josh Yeager 的观点,但我进入了“控制面板”>“控制面板”>“控制面板”。文件夹选项>文件类型选项卡并在那里完成。
有趣的是,我的“DDE MEssage”框中已经有一个“%1”,但它不在注册表中价值。在所有内容中单击“确定”即可更新相应的密钥,虽然这需要多次点击,但养成这种习惯比在注册表中翻来覆去更好。手指粗的人可能会在注册表中遇到很多麻烦......(这就是我,顺便说一句:-D)
哦,就像 Herb Caudill 指出的那样,“/dde”需要位于注册表中,但再次使用文件夹选项区域将处理适当的条目。
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.
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.
运行 regedit 并转到以下键:
检查以确保您拥有正确的版本。在我的例子中,它是 12.0
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssms.sql.12.0\Shell\Open\Command
编辑默认值以在末尾添加“%1”。
该值现在应如下所示:(修改路径名以匹配您电脑上的 ssms.exe 程序)
“c:\Program Files\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\ssms.exe”/dde “%1”
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"
Windows 注册表编辑器版本 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]
@=“系统”
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"
您是否安装了最新的相关 SQL Server 服务包?
SQL Server 2005 和 2008 需要在 Windows 7 上修补。本文是关于express的,但应该应用相同的“修复”。这对于每个新的 MS 操作系统都很常见。
一般来说,无论如何,您的客户端工具始终与服务器安装的版本相同。
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.