Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

When a SQL file will not open in SSMS

By Lynn Collins,

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.

 

 

 

Total article views: 5154 | Views in the last 30 days: 6
 
Related Articles
FORUM

SQL Server Management Studio - validade database button

SQL Server Management Studio - validade database button

FORUM

Microsoft SQL Server Management Studio Question

Microsoft SQL Server Management Studio Question

ARTICLE

SQL Server Management Studio

After quite a few versions, Enterprise Manager is being retired. SQL Server 2005 will have a new man...

FORUM

Sql Server Management Studio Bahaving WIERD

Sql Server Management Studio Bahaving WIERD

FORUM

Linked Server, show tables in SQL Server Management Studio

"Linked Server" Tables "SQL Server Management Studio"

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones