When a SQL file will not open in SSMS

  • lyco_us

    Grasshopper

    Points: 16

    Comments posted to this topic are about the item When a SQL file will not open in SSMS

  • Craigmeister

    Ten Centuries

    Points: 1025

    Nice job sniffing that one out. That little tip will make me look like a super SQL expert with the boss as I am sure that if anyone here has that issue it will be him.

    Thanks.

  • paul.knibbs

    SSCoach

    Points: 15270

    You actually get a similar problem if you have a SQL file that's Unicode but without the proper Unicode byte-ordering mark at the beginning--that'll open in Notepad when you double-click it, rather than SSMS! Had that issue the other week.

  • jcunningham

    Old Hand

    Points: 397

    This worked for me on Windows 7, but it did not work on my Server 2008 R2 box. Anyone else having this issue there?

  • Libby

    Ten Centuries

    Points: 1175

    I have not had the problem - but do appreciate you taking the time to document it. Thanks!

  • margo@on2morning.com

    Mr or Mrs. 500

    Points: 561

    I have this exact same thing (not sure what's caused it). I tried your tip, but it didn't work for me. Maybe uninstalling/reinstalling helped you out after all? I'm not sure I want to go through that much effort, but it is annoying...

  • TedNESG

    SSC Rookie

    Points: 31

    Good Grief ! A simple thing can cause so much aggravation. Thanks for sharing...just updated my SSMS

    Ted

  • chrisfradenburg

    SSCrazy Eights

    Points: 9592

    Have you tried looking for the registry key he mentioned? If that's there then maybe you have the problem that the other people were addressing instead of the one Lynn did.

  • thisisfutile

    Hall of Fame

    Points: 3492

    On my workstation, the Options > Source Control only has "Plug-in Selection" under it in the tree menu so file association through SSMS isn't an option on my install.

    I know for a fact this all started when I installed SQL 2008 Express over top of my SSMS 2005 on my workstation. My setup is a 2005 server on a different box and my workstation has always had 2005 SSMS on it for administring the server. Some time ago I installed 2008 Express on this workstation and that's the day my trouble began. So, that leads me to believe that my 2008 SSMS install doesn't offer the "file association" option.

    Thanks for posting this because I too have scoured forums only to find the registry tweak you mentioned above. I've also tried just using Windows File Association settings with some fancy suggestions on those same forums but those not only wouldn't open the files, they also generated a new warning pop-up window too.

    UPDATE: I just realized I was looking in the wrong area but made the mistake of making a second post to announce it...sheesh, one mistake on top of another...I'll be SO GLAD when we get our office moved at the end of this week (slightly stressed-out here) 😛

  • Mary Kay Malensek

    Valued Member

    Points: 62

    I have the same exact scenario, but unfortunately this didn't fix it for me. I was really hopeful, so thanks for posting this. And I already checked my registry key and tried uninstalling and re-installing. It's just annoying issue.

  • Adam Belebczuk

    SSC Rookie

    Points: 41

    Thank you so much for finding this fix. This issue has been driving me crazy for months now and I just haven't had the time to research it. I was able to apply your fix in seconds and now the issue is resolved. Thanks again!

  • thisisfutile

    Hall of Fame

    Points: 3492

    thisisfutile (4/27/2011)


    On my workstation, the Options > Source Control only has "Plug-in Selection" under it in the tree menu so file association through SSMS isn't an option on my install.

    So while I'm an idiot for not reading the article more closely and realizing that it's not under "Source Control" but rather under "Text Editor"....do I get any redemption points for catching my own error.

    😛

    My setup is a 2005 server on a different box and my workstation has always had 2005 SSMS on it for administring the server. Some time ago I installed 2008 Express on this workstation and that's the day my trouble began.

    One thing to note, my server ONLY has SQL 2005 Standard on it and it has never had any trouble opening SQL files in SSMS on a double-click. This is significant because it doesn't have anything associated to the file extensions in the Text Editor > File Extensions area. This leads me to believe that as I pointed out in my original post that this error starts with installing a different instance of SSMS on top of another. Of course, I haven't done any testing (nor do I plan to)...just a theory.

  • brettcrain

    Newbie

    Points: 5

    I have this issue occurring in my installation of SQL Server 2008 SSMS, but only intermittently. Sometimes when I double-click a .sql file, SSMS will gain focus, but the document will not open in the editor. I need to tab back to File Explorer and double-click the file again for it to open in the editor. The following steps will always reproduce the issue.

    1) Launch SSMS

    2) Double-click a .sql file for File Explorer.

    3) Click cancel when prompted to open a connection.

    4) Close the document you just opened (not SSMS, just the document)

    5) Go back to File Explorer and try to open the same (or a different) .sql file.

    6) SSMS gains focus but no document opens.

    Does anyone else find this behavior? I know it happens under more scenarios also, but this is one that I could pinpoint.

  • haveSomeYuccaCake

    Grasshopper

    Points: 15

    I second that. I have SQL Server 2008, and adding the sql file extension to the text editor list from the Options menu did not appear to change things.

  • Misha_SQL

    SSCertifiable

    Points: 5386

    Wow! Thank you for sharing this solution. Life would be way too easy without annoying problems like this.

Viewing 15 posts - 1 through 15 (of 27 total)

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