如何在一个ssms实例中打开多个.sql文件 [英] How to open multiple .sql files in only one ssms instance

查看:1719
本文介绍了如何在一个ssms实例中打开多个.sql文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是DBA,运行带有SQL Server 2008和SQL Server Management Studio的Windows Server 2008 Enterprise SP1的新服务器框。



在我的上一个框中Visual Studio与数据库解决方案与许多.sql文件我用来双击.sql文件,并在同一个SSMS实例(如果任何已经打开)中打开。但是(即使在新框中具有完全相同的安装)我现在得到一个新的SSMS实例,当双击每个sql文件。它真的很痛苦的一个.sql - 一个SSMS实例,所以我开始我的研究。



到目前为止我试过:



1)右键单击.sql文件>打开方式选项>添加选项>程序名称:C:\Program Files \ Microsoft SQL Server \100\Tools\ Binn\VSShell\Common7\IDE\Ssms.exe和友好名称:SQL>确定>设置为默认值。不工作。仍然有一个sql - 一个ssms实例。



2)Perfomed运行> regedit>并修改HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\打开\Command并将/ 1替换为%1。无法运行



3)右键单击.sql文件>打开方式选项>添加选项>程序名称:explorer.exe名称:Explorer>确定>设置为默认值。不工作。当双击.sql文件时,记事本中包含脚本内容。



4)这样的页面



http://social.msdn。 microsoft.com/Forums/en/sqltools/thread/ac2f39c5-66e5-495c-b7a6-47e743853baf



要求更改文件关联,但打开Windows资源管理器时>工具>文件夹选项...我发现没有文件类型选项卡。多烦!



有人能帮我吗?



提前感谢

解决方案

在我的大部分工作日寻找解决方案后,我终于找到了它。感谢上帝,我几乎用完了这个问题。希望它帮助别人!!!



更新:连结网域已过期,请按照下列步骤操作:


Microsoft工具通常是如何集成的结果是
令人沮丧时,当你告诉Visual Studio使用Sql
服务器管理工​​作室(SSMS)打开SQL文件。我真的不喜欢使用Visual
Studio来编辑T-SQL文件,但在过去,在我发现这个
提示之前,我打开的每个SQL文件都将在SSMS的新实例中打开。尝试
it:


  1. 打开包含SQL文件的解决方案

  2. 右键单击任何SQL文件并选择打开方式...

  3. 点击添加

  4. 浏览到C:\Program Files \ Microsoft SQL Server \100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe或如果您是
    运行x64 WindowsC:\Program文件(x86)\Microsoft SQL
    Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe,然后单击确定

  5. 单击设置为默认,然后选择确定。

现在打开多个SQL文件。每次你会得到一个不同的实例
的SSMS打开。很痛苦!



注意:整篇文章适用于SQL 2005,只需使用
SQLWB替换SSMS。



如何解决这个问题?重复上述步骤1-3,但在步骤#4输入
以下值:




  • 计划名称:explorer.exe


  • 重复步骤5(设为默认值) ),然后单击确定。现在,打开
    个附加文件。它们应该在同一个SSMS实例中打开。



    Visual Studio向SSMS.exe发出一个命令,
    包括文件的路径在解决方案资源管理器中选择。它是
    到SSMS检查一个新的实例,它不是。但是当
    将文件名传递给explorer时,它会在同一个实例中打开。



    QUIRK警告!



    如果SSMS尚未打开,您尝试打开的第一个文件(不是
    ,而是每次从Visual
    Studio和SSMS打开一个SQL文件时都不会打开但是)SSMS将打开,但您的文件将
    不。第二次点击文件,它将打开此文件。
    不要问我解释它只是(我不知道为什么)。
    结束语



    当你告诉Visual Studio SSMS是默认编辑器
    的结果是有意义的,但我不知道为什么会是不同当你告诉
    explorer打开它。也许如果我是一个Windows开发人员而不是一个
    的web开发人员,我会知道答案。但无论如何,现在你知道。
    享受。



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

解决方案

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:

Considering how integrated Microsoft tools usually are the result is frustrating when you tell Visual Studio to open SQL files using Sql Server Management Studio (SSMS). I really don't like using Visual Studio to edit T-SQL files but in the past, before I discovered this tip, each SQL file I opened would open in a new instance of SSMS. Try it:

  1. Open a solution which contains SQL files
  2. Right-click any SQL file and select "Open With…"
  3. Click "Add"
  4. Browse to "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" or if you're running x64 Windows "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe", then click "OK"
  5. Click "Set as Default" and then "OK"

Now open multiple SQL files. Each time you'll get a different instance of SSMS opened. What a pain!

NOTE: This entire article applies to SQL 2005, just replace SSMS with SQLWB.

How do you resolve this? Repeat steps 1-3 above, but at step #4 enter the following values:

  • Program Name: "explorer.exe"
  • Friendly Name: "Windows Explorer"

Repeat step #5 (set as default) above and then click OK. Now, open additional files. They should all open in the same instance of SSMS.

It would seem that Visual Studio issues a command to SSMS.exe which includes the path of the file selected in the solution explorer. It is up to SSMS to check for a new instance, which it doesn't. But when you pass the file name to explorer it gets opened up in the same instance.

QUIRK WARNING!

If SSMS is not already open, the first file you attempt to open (not first time ever, but every time you open an SQL file from Visual Studio and SSMS isn't open yet) SSMS will open, but your file will not. Click the file a 2nd time and it will open the file this time. Don't ask me to explain it it just is (and I have no idea why). Conclusion

The result when you tell Visual Studio that SSMS is the default editor makes sense, but I don't get why it would be different when you tell explorer to open it. Maybe if I were a Windows developer instead of a web developer I would know the answer. But either way, now you know. Enjoy.

这篇关于如何在一个ssms实例中打开多个.sql文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆