views:

42

answers:

1

This is more an annoyance than a real problem, but it would be great if someone had a trick to get it to work.

Let's say I have a .Sql file, MyScript.Sql. If I go to the file location in Windows Explorer and double click it, it opens SSMS. Good, that's what I want. However if I double click on that file again (or a different .sql file), I get a new instance of SSMS. So regardless of whether the file is already open I get a new instance of SSMS. If I open a different file, it doesn't reuse the first instance of SSMS, it opens a new one. Basically any .Sql file will open an entirely new instance of SSMS. This seems very dumb. Is it broken and gonna stay that way? Is there a solution?

I've tried the solution on social.msdn but it didn't work. Basically it looks like I can get re-use but only if I use VS to open the file. Which isn't great because there are lots of reasons I prefer to edit sql in SSMS.

I'd be open to writing some sort of little intermediary app that takes in a file name, finds an existing ssms process and tells that app to open the file. If such a thing is even possible.

+1  A: 

One instance of SSMS can't open two instances of the same file. Something to do with file handles I assume. So even your little intermediary app solution won't "fix" this. Why do you want to open the same file multiple times? If it's already open, how are you going to consolidate changes in both instances? If the goal is to save one copy as a different file, then just save the first file with a different name, then SSMS will treat the existing file as a "different" file. At least I think so; not at a PC where I can check.

Aaron Bertrand
I think you misunderstand. I want one instance of SSMS to open all the subsequent sql files I double click. I wouldn't want one instance to open the same file twice, but it essentially does this. Read the sentence that starts with "However if I double click".
jcollum
I *did* read that sentence, multiple times. Let me remind you what you said: "However if I double click on *THAT* file again..." (emphasis mine). Hence it seems you wanted to open the SAME file twice. If that is not your intent, then please edit your question and make it more clear.FWIW, I have no problems double-clicking multiple .SQL files and having them open in my existing SSMS window. That said, I find it much more convenient to navigate to files using File | Open within SSMS, than to swim through Explorer manually and double-click.
Aaron Bertrand
I edited the question. I wonder how you've managed to get SSMS to do reuse. Maybe it's because I'm on winxp (ugh, work). I was using the example of opening the same file because that seems so very very broken. Seems like most apps understand that you shouldn't open the same file in multiple instances of the same program.
jcollum
@jcollum: My copy's also single-instance, can't even find a way to make it multiple-instance. What happens if you drag a .sql file from Explorer into the SSMS window?
Aaronaught
@Aaron: it will open in that instance of SSMS. So it works that way, but that's lame.
jcollum
Not really the answer, but this question is getting stale, so it wins.
jcollum