4

When I double click on a .sql file in Source Explorer in VS2012, it opens right there in Visual Studio. How can I get it to open in SQL Server Management Studio instead?

Jonathan Nixon
  • 4,940
  • 5
  • 39
  • 53
AngryHacker
  • 59,598
  • 102
  • 325
  • 594

1 Answers1

3

Change the option for sql extensions from within VS.

Change extension of

or right click and change the default action for .sql files.

enter image description here

I misunderstood your question at first.

Go to : Tools >> Options >> Environment >> Tabs and Windows

Then uncheck the "Allow new files to be opened in the preview tab" in the Preview Tab section.

Stack Exchange similar question

You can also right click on the file and select open with. You may have to browse to SSMS which is located below.

Depending on your version of SSMS installed and OS it will be located in one of these folders:

  • on x64 machine: C:\Program Files (x86)\Microsoft SQL Server{your_version}\Tools\Binn\VSShell\Common7\IDE

  • on x32 machine:

    C:\Program Files\Microsoft SQL Server{your_version}\Tools\Binn\VSShell\Common7\IDE

Community
  • 1
  • 1
SoftwareCarpenter
  • 3,835
  • 3
  • 25
  • 37
  • Messing with Tools/Options did not do the trick. The file still opened in VS. As far as right-click and Open With - such an option does not exist on the context menu. – AngryHacker Dec 31 '12 at 19:45
  • 1
    Your last edit is probably going to work, but I didn't have a chance to try it. I installed VS2012 TFS Power Tools and it added the feature in the context menu. So it works now. Thanks. – AngryHacker Dec 31 '12 at 20:18
  • Glad you got it working. I was thinking that perhaps you did not have the power tools installed and that is why I could see it on my end. – SoftwareCarpenter Dec 31 '12 at 20:27
  • Can you confirm that VS2012 TFS Power Tools provides the feature in question? – BozoJoe Jan 14 '13 at 16:24
  • The open-with will show up from the solution files context. Once you have associated the file extension or opened a file using the open-with context from the solution context then TFS will open the file with that association. No power tool is needed. – SoftwareCarpenter Jan 14 '13 at 17:29
  • Yes, if you have TFS 2012 powertools installed then if you go to options->Microsoft Team Server Foundation Power Tools 2012--> General then there is a property called View with in source control explore which can be set to true or false. However you do not have to have the powertool installed to get the same functionality. It just makes it easier. – SoftwareCarpenter Jan 18 '13 at 21:43