SQLServerCentral Article

When a SQL file will not open in SSMS

,

I am running SQL Server Management Studio 2005 on a Windows 7 machine here at work. I am not sure when this started happening, but when I double-click a .sql file in Explorer, SQL Server Management Studio (SSMS) would open, but would not load the file in question. It would also not bring up a logon screen to connect to an instance. I tried unassociating the .SQL extension and then re-associating it using "Open With" SQL Server Management Studio, but it never worked. I made suggested registry modifications; uninstalled and reinstalled SSMS, but nothing would resolve the issue. Then "duh"....I looked at the SSMS Tools menu. To my surprise, the "File Extension" window was empty!

Surprisingly, I haven't been able to find this solution ANYWHERE, even in Microsoft SQL Help Solutions. Microsoft, and almost every other site, refers to modifying the "HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command" to fix this issue. Even after uninstalling/installing SSMS, I was never able to find this Registry Key.

I hope this solution helps, and here is what I did.

  1. Open SQL Server Management Studio
  2. Select Tools > Options
  3. Expand Text Editor > Select File Extension
  4. Type "sql" in the "Extension" box
  5. Select "Editor" Drop-Down and choose "SQL Query Editor"
  6. Click "Apply" and "OK"
  7. Repeat Steps 1-6 to allow "txt" files to open in SSMS (by Right-Clicking on Text File and selecting "Open With "SQL Server Management Studio"

Now close SSMS and double-click on a .sql file. Your script should now open in SSMS Query Window.

 

 

 

Rate

4.33 (39)

You rated this post out of 5. Change rating

Share

Share

Rate

4.33 (39)

You rated this post out of 5. Change rating