我是 DBA,拥有一台运行 Windows Server 2008 Enterprise SP1、SQL Server 2008 和 SQL Server Management Studio 的新服务器。
在我之前的框中,当在 Visual Studio 中使用包含大量 .sql 文件的数据库解决方案工作时,我常常双击 .sql 文件,然后在同一个 SSMS 实例中打开它们(如果已打开)。但是(即使在新框中具有完全相同的安装)我现在在双击每个 sql 文件时都会获得一个新的 SSMS 实例。一个 .sql - 一个 SSMS 实例真的很痛苦,所以我开始对此进行研究。
到目前为止我已经尝试过:
1)右键单击 .sql 文件> “打开方式”选项> “添加”选项> “程序名称:C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”和“友好名称:SQL”> “好的”> “设置为默认值”。不起作用。仍然有一个 sql - 一个 ssms 实例。
2)执行运行>注册表编辑器>修改HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command的值数据,将/dde替换为“%1”。不起作用
3) 右键单击 .sql 文件 > “打开方式”选项> “添加”选项> “程序名称:explorer.exe”和“友好名称:Explorer”> “好的”> “设置为默认值”。不起作用。双击 .sql 文件时,记事本会附带脚本内容。
4)有些页面像这样
http://social.msdn.microsoft.com/Forums/en/sqltools/thread/ac2f39c5-66e5-495c-b7a6-47e743853baf
要求更改文件关联,但在打开 Windows 资源管理器时 > ;工具>文件夹选项...我发现没有“文件类型”选项卡。真烦人!
有人可以帮我吗?我的病人,它真的快用完了。
提前致谢
I'm DBA with a new server box running Windows Server 2008 Enterprise SP1 with SQL Server 2008 and SQL Server Management Studio.
In my previous box when working in Visual Studio with database solution with lot of .sql files I used to double-click on the .sql files and they were opened in the same SSMS instance (if any already opened). However (even when having exactly the same installation in the new box) I'm now getting a new SSMS instance when double clicking in each sql file. Its really painful one .sql - one SSMS instance so I started my research about that.
What I've tried till now:
1) Right click on the .sql file > "Open With" option > "Add" option > "Program Name: C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" and "Friendly Name: SQL" > "Ok" > "Set as Default". Does NOT work. Still having one sql - one ssms instance.
2) Perfomed Run > regedit > and modify the value data of HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command and replace /dde with "%1". DOES NOT WORK
3) Right click on the .sql file > "Open With" option > "Add" option > "Programe Name: explorer.exe" and "Friendly Name: Explorer" > "Ok" > "Set as default". Does NOT work. When double-clicking on the .sql files Notepad comes with scripts content.
4) Some pages like this
http://social.msdn.microsoft.com/Forums/en/sqltools/thread/ac2f39c5-66e5-495c-b7a6-47e743853baf
asks to change file association but when opening Windows Explorer > Tools > Folder Options ... I found there is no "File Type" tab. How annoying!
Can someone help me on that? My patient it's really running out.
Thanks in advance
发布评论
评论(13)
在花了我大部分工作日寻找解决方案后,我终于找到了。感谢上帝,我几乎快要解决这个问题了。希望它对其他人有帮助!
更新:链接域已过期,所以内容如下:
After spending most of my working day looking for the solution I finally found it. Thanks God, I was almost running out with this issue. Hope it helps somebody else!!!.
Update: linked domain expired, so here's what it said:
我以前也遇到过这个问题,我发现有一个简单的解决方案->只需检查您的 SSMS 是否位于“以管理员身份运行此程序”选项下(右键单击快捷方式图标 -> 属性 -> 兼容性 -> 权限级别)。如果是,请取消选中该选项并尝试双击该 sql 文件。
希望这有帮助。
I have this problem before, I found there is a simple solution -> just check if your SSMS is under "Run this program as an administrator" option (right click on the shortcut icon -> property -> Compability -> Privilege level). If yes, untick the option and try double click the sql file.
Hope this helps.
我的多个 SSMS 实例版本 19 的问题已通过将 HKEY_CLASSES_ROOT.sql 默认键更改为
My issue with multiple SSMS instances version 19 was fixed by changing HKEY_CLASSES_ROOT.sql Default key to
类似的问题已多次报告,但它们没有解决该问题(删除了链接,因为 Microsoft 不假思索地删除了 Connect):
安装 SQL Server 后是否安装了 Visual Studio(或任何 Visual Studio 组件)??
我的猜测是,连接项目不会被修复 - SQL 将责怪 Visual Studio,Visual Studio 将责怪 SQL,并且这些项目将保持打开状态...
所以这是我的建议:运行修复从程序和功能中删除 SQL Server,然后重新应用 SQL Server 2008 (SP2) 的最新 Service Pack。
此外,“文件类型”界面也从“工具/文件夹选项”界面移至“控制面板”。进入控制面板>默认程序> “将文件类型或协议与程序关联起来。”然而,这里似乎没有添加命令行选项(如“%1”或/dde)的选项。
Similar issues have been reported multiple times, but they aren't addressing the issue (removed links because Microsoft erased Connect without much thought):
Did you install Visual Studio (or any Visual Studio components) after installing SQL Server?
My guess is that the Connect items will not be fixed - SQL will blame Visual Studio, Visual Studio will blame SQL, and the items will remain open...
So here is what I suggest: run a repair of SQL Server from Programs and Features and then re-apply the latest service pack of SQL Server 2008 (SP2).
Also the "File Types" interface was moved from the Tools / Folder Options interface to the Control Panel. Go into Control Panel > Default Programs > "Associate a file type or protocol with a program." However it doesn't seem to have the options here to add command-line options like "%1" or /dde.
也尝试添加这些注册表项,但请确保将 /dde 放回:
为了记录,这是我对该部分的完整导出:
Try adding these reg keys as well, but make sure you put the /dde back in:
For the record, here is my entire export for that section:
转到工具>>文件夹选项>>文件类型并应用以下设置。它终于对我有用了! (在谷歌搜索了半天后)。
单击新建/编辑(在此窗口中,应选中“下载后确认打开”,并取消选中“始终显示扩展名”)
在下一个窗口中,进行以下输入
问候,
Sandeep Gaadhe
Go to Tools >> Folder Options >> File Types and apply below settings. It worked for me finally!!! (after half a day search on google).
Click New/Edit (on this window "Confirm open after download" should be check and "Always show extension" should be unchecked)
In next window, make below entries
Regards,
Sandeep Gaadhe
我正在使用 SQL Server Management Studio 2012 Express,我通过将“Program”指向“explorer.exe”来使其工作,
这就是我的寄存器的设置方式:“C:\Program Files (x86)\Microsoft SQL Server\ 110\Tools\Binn\ManagementStudio\ssms.exe" /dde
位于
HKEY_CLASSES_ROOT\ssms.sql.11.0\Shell\Open\Command
I am using SQL Server Management Studio 2012 Express and I have made this to work by pointing "Program" to "explorer.exe"
This is how my register is set up: "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\ssms.exe" /dde
at
HKEY_CLASSES_ROOT\ssms.sql.11.0\Shell\Open\Command
我已经 2005 &安装了 2008 SSMS,因此我默认使用 2005 实例。如果我在从 Windows 资源管理器打开 .sql 文件时打开了 2008 ssms,它将在现有的 2008 ssms 中打开(而不是尝试打开新实例!)
I've 2005 & 2008 SSMS installed so I defaulted to the 2005 instance. If I have 2008 ssms open when opening a .sql file from windows explorer it will now open in the existing 2008 ssms (and not try to open a new instance!)
从 Windows 资源管理器中,可以将选定的文件(单个或多个)拖放到 SSMS 窗口中。
From Windows Explorer, one can drag-and-drop selected files (single or multiple) into an SSMS window.
要检查的一件事是您是否有多个版本的 SSMS。如果您碰巧使用的是旧版本,双击文件将打开新的 SSM 版本。或者无论 sql 文件的默认版本是什么。
One thing to check is if you have multiple versions of SSMS. If you happen to be working in an older version, double clicking on a file will open the new SSM version. Or whatever the default version is for sql files.
对于希望 SSMS 始终以管理员权限打开的用户的快速说明。
右键单击>更多>打开文件位置
。右键单击>打开文件位置
。右键单击 Ssms.exe>“兼容性疑难解答”
。点击程序疑难解答
。程序需要额外权限
,然后点击下一步
。测试程序
...下一步
,然后按是,保存此程序的这些设置
。Arvo Bowen Jan 20 20 年 3 月 30 日 15:27
效果非常好。
A quick note for users who want to have SSMS always open with Administrator privileges.
Right-click>More>Open File Location
.Right-click>Open File Location
.Right-click on Ssms.exe>Troubleshoot compatibility
.click Troubleshoot program
.The program requires additional permissions
then hitNext
.Test the program
....Next
and thenYes, save these settings for this program
.Arvo Bowen Jan 30 '20 at 15:27
This work perfectly.
我知道这是一篇相当老的帖子,有很多不同的答案和可能的解决方案。但我认为这是一个新的(至少对于SO来说)。
我突然开始出现这种行为(即每个新文件都会在新会话中打开)并且无法弄清楚原因。事实证明,这是因为在我的 SSMS 会话中,我进行了一次公开对话,但该对话已落入后台。
当我关闭对话时,新文件开始在我原来的会话中打开 /facepalm
也许每个人都已经知道这一点,但以防万一它可以节省任何人 20 分钟!
I know this is quite an old post and there are loads of different answers with possible solutions. But here's one I think is new (at least to SO).
I suddenly starting getting this behaviour (i.e. each new file would open in a new session) and couldn't figure out why. Turns out it was because in my SSMS session I had an open dialogue which had dropped into the background.
A soon as I closed the dialogue, new files started opening in my original session /facepalm
Maybe everyone knows this already but just in case it saves anyone 20 mins!
老问题,但就我而言,在最近打开的 .sql 文件的应用程序列表中,同时列出了“SQL Server Management Studio”和“SSMS 18”,这导致它打开一个新实例。
我选择了“选择另一个应用程序”,选择了“SQL Server Management Studio”,然后选中了“始终使用此应用程序打开 .sql 文件”。问题解决了。
Old question, but in my case, in the recent list of apps to open for .sql files, there were both "SQL Server Management Studio" and "SSMS 18" listed, which was causing it to open a new instance.
I selected "Choose another app", selected "SQL Server management Studio", and checked "Always use this app to open .sql files." Problem solved.