This is driving me nuts! I can no longer open a .sql file in Management Studio

  • Some may say that it's a short drive. 🙂

    I spend most of my DBA workday with Oracle. Our SQL Server DBA recently left without notice, and our remaining DBAs are getting up to speed with SQL Server 2005.

    In the past, I associated *.sql files with TextPad, our site standard text editor. After SQL Server Management Studio 2005 was installed on my PC, double clicking on a .sql file opened the file in Management Studio, instead of TextPad. Okay... Seemed simple enough. A few days ago, I reassociated the .sql extension with TextPad, and TextPad started opening the .sql files. I thought I was past the issue.

    However, I started working on SQL Server again yesterday and noticed that every time I attempt to "File, Open, File..." a .sql file in Management Studio, it simply pops up in a new Notepad window instead of opening the file in Management Studio, despite the fact that Management Studio is open and was used to open the .sql file. I changed the .sql file extension association back to Management Studio, and .sql files still open the file in Notepad, meaning that I can no longer open .sql scripts in Management Studio. If I try to drag a file to Management Studio, it "bounces off" into a new Notepad window.

    I've never seen this before... If I just double click on a .sql file in Windows Explorer, Management Studio *and* Notepad open. That's crazy! Grrrrrrrrr.

    I've tried rebooting after making an association change, and that doesn't help. Any ideas on how to cure this?

  • In Management Studio, go to Tools, Options, and check what's in the Text Editor tab. There's a section on File Extensions. Anything set in there?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • It was empty earlier (prior to my post), but setting it for .sql didn't seem to make a difference.

    Hmmm....

    I just double checked. I thought I had cleared that out, but I apparently left an entry for .sql there. I removed it (leaving the list empty), and I can now open .sql files. THANK YOUUUUUUUU!

  • I spoke too soon. I closed Management Studio, and the old behavior is back. I double checkted the "Text Editor" information, and it is still blank. I'm not sure where else to look.

  • Have you attempted to re-associate the file type via windows explorer? Right-click the *.sql file in windows explorer and select properties. Click the change button under opens with and browse to the SSMS executable (i.e. C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe).

  • No, I was hoping there was something in there that was confusing it.

    Check what's in the Windows registry. Might be a double-entry or messed up entry there.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Tommy Bollhofer (12/9/2009)


    Have you attempted to re-associate the file type via windows explorer? Right-click the *.sql file in windows explorer and select properties. Click the change button under opens with and browse to the SSMS executable (i.e. C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe).

    Yes, Windows Explorer was the tool that I used to make the initial change and most of the changes I have attempted since then.

  • Tommy Bollhofer (12/9/2009)


    Have you attempted to re-associate the file type via windows explorer? Right-click the *.sql file in windows explorer and select properties. Click the change button under opens with and browse to the SSMS executable (i.e. C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe).

    I read a little closer. Apparently, you are running 2008 because I have a 90 directory instead of 100. However, I cannot located Ssms.exe in C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE. Is the file called something else in 2005?

  • shew (12/9/2009)


    Tommy Bollhofer (12/9/2009)


    Have you attempted to re-associate the file type via windows explorer? Right-click the *.sql file in windows explorer and select properties. Click the change button under opens with and browse to the SSMS executable (i.e. C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe).

    I read a little closer. Apparently, you are running 2008 because I have a 90 directory instead of 100. However, I cannot located Ssms.exe in C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE. Is the file called something else in 2005?

    Correct, for 2005 it should be -

    C:\Program Files\Microsoft SQL Server\90\Tools\binn\VSShell\Common7\IDE\SqlWb.exe

  • I have a partial resolution. Our Desktop PCs are locked down pretty tight. An administrator logged onto my PC and ran:

    assoc .sql=

    This blew away the association, and I can at least open a .sql file in Management Studio with "File, Open, File...," but Notepad *and* Management Studio still both open when I double click a .sql file.

    [GRUMBLE]What gives Microsoft the right to lay claim on all .sql files?[/GRUMBLE] I suppose it's because it can. Sigh...

    Thanks for all the suggestions.

  • File associations are controlled through the registry. Check there. Might be a problem.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply