开发者

Visual Studio - Open a SQL file with SQL Management Studio in an existing SSMS window?

I'm using Visual Studio 2008 and SQL Server 2008. I would like .sql files in my VS projects to open in SQL Management Studio by default. No problem so far: I right-click the file, Open With, Add SSMS, and set 开发者_开发百科it as the default. What I don't like is that it opens a new instance of SSMS every time, and I would like it to open in an existing instance if there is one.

I noticed that the Open command associated with .sql files in Windows (which has the behavior I want) calls ssms.exe with the /dde switch. Not exactly sure what switch does, but I played around with it and it doesn't seem to have anything to do with opening files in an existing instance.

Any idea how I can get this behavior to work from within Visual Studio?

Thanks in advance!


Right click the .sql file within Visual Studio, then click "open with", then click "add..." in "Open with" dialog. In the "add program" dialog type "explorer.exe" into the program name field and somehting into "firendly name" field e.g. "with explorer", then click ok. Then select "with exlorer" in "Open with" dialog and click "set as default". Now VS will open .sql files with explorer wich will in its turn call SSMS.

Normally if you open 2 different .sql fiels in explorer you get them in a single SSMS window. If it still opens 2 ssms windows, you need to correct the registry (HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command, replace /dde with %1)


Right - click on C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe file -> Properties -> Go to Compability Tab -> Uncheck all the checkbox.

Rerun SQL Management Tool.


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

folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜