locked
File associations in Vista - opening in CURRENT instance RRS feed

  • Question

  • I am running Windows Vista and using SQL Server Management Studio 2008. Whenever I double click a .sql file, it opens in a BRAND NEW instance of SQL Server Management Studio, but I want it to open in my already open, current instance of management studio. I have played around with the file associations in Vista but can't find any options to change this. I suspect it is a registry setting.  How can I change this?

    Tuesday, March 30, 2010 5:46 PM

Answers

  • You may try adding the "/dde" parameter in the command. Generate the .sql file association info and post here.

    1. Download FileExtInfo.zip from here:
        http://windowsxp.mvps.org/fileextinfo.htm

    2. Unzip the utility and extract the files to Desktop.
    3. Double-click "FileExtInfo.exe" to run it.
    4. Select .SQL file type from the list box
    5. Click "View file association report"
    6. Copy the contents of the report and include it in your reply.

     


    Ramesh Srinivasan, Microsoft MVP (since 2003) for Windows Desktop Experience. The Winhelponline Blog http://www.winhelponline.com/blog/ (Windows 7/Vista/XP Troubleshooting)
    Wednesday, March 31, 2010 7:46 AM

All replies

  • You may try adding the "/dde" parameter in the command. Generate the .sql file association info and post here.

    1. Download FileExtInfo.zip from here:
        http://windowsxp.mvps.org/fileextinfo.htm

    2. Unzip the utility and extract the files to Desktop.
    3. Double-click "FileExtInfo.exe" to run it.
    4. Select .SQL file type from the list box
    5. Click "View file association report"
    6. Copy the contents of the report and include it in your reply.

     


    Ramesh Srinivasan, Microsoft MVP (since 2003) for Windows Desktop Experience. The Winhelponline Blog http://www.winhelponline.com/blog/ (Windows 7/Vista/XP Troubleshooting)
    Wednesday, March 31, 2010 7:46 AM
  • I'm having the same problem.  I downloaded your app and the report is below.   Running SQL2008 on Win7...

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    File association information for [.SQL] file type
    Generated by FileExtInfo v2.0 on 4/5/2011 11:23:02 AM

    FileExtInfo © 2005-2007 Ramesh Srinivasan.
    Homepage: http://www.winhelponline.com
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    [HKEY_CLASSES_ROOT\.SQL]
    @="sql_auto_file"
    "PerceivedType"="text"

    [HKEY_CLASSES_ROOT\.SQL\PersistentHandler]
    @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"


    [HKEY_CLASSES_ROOT\sql_auto_file]
    @=""

    [HKEY_CLASSES_ROOT\sql_auto_file\shell]

    [HKEY_CLASSES_ROOT\sql_auto_file\shell\open]

    [HKEY_CLASSES_ROOT\sql_auto_file\shell\open\command]
    @=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,\
      00,65,00,73,00,25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,\
      4e,00,54,00,5c,00,41,00,63,00,63,00,65,00,73,00,73,00,6f,00,72,00,69,00,65,\
      00,73,00,5c,00,57,00,4f,00,52,00,44,00,50,00,41,00,44,00,2e,00,45,00,58,00,\
      45,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00


    [HKEY_CLASSES_ROOT\SystemFileAssociations\text]

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\DefaultIcon]
    @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
      00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
      61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,\
      00,30,00,32,00,00,00

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\OpenWithList]

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\OpenWithList\Notepad.exe]
    @=""

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\OpenWithList\WordPad.exe]
    @=""

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell]

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit]

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit\command]
    @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
      00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
      54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
      00

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\open]

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\open\command]
    @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
      00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
      54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
      00

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\ShellEx]

    [HKEY_CLASSES_ROOT\SystemFileAssociations\text\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
    @="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"


    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SQL]

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SQL\OpenWithList]
    "a"="WORDPAD.EXE"
    "MRUList"="ba"
    "b"="Ssms.exe"

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SQL\OpenWithProgids]
    "sql_auto_file"=hex(0):

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SQL\UserChoice]
    "Progid"="Applications\\Ssms.exe"

    Tuesday, April 5, 2011 4:38 PM
  • I have a fix that worked for me.  I am on Windows 7 32-bit and SQL Server Management Studio 2008 R2.

    1. Change the registry value of...

           Key:            HKEY_CLASSES_ROOT\.sql

           Old Value:   sql_auto_file            (yours may be different)

           New Value:  sqlwb.sql.9.0

           NOTE: Even though SS 2008 is version 10.0 (not 9.0 as entered above), this worked.

    2. Change the registry value of...

           Key: HKEY_CLASSES_ROOT\sqlwb.sql.9.0\Shell\Open\Command

           Old Value: "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" /dde

           New Value: "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" /dde "%1"

                             (Note the "%1" at the end. Include all indicated quotes).

           NOTE: If you are using SS 2005, you may need to try this:

           "c:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\sqlwb.exe" /dde "%1"

    3. Reassign SSMS.exe (or SQLWB.exe for 2005) as the default program for your ".sql" extension. I had to do this even though it was ALREADY assigned as the default. To do this in Windows 7, go to the "Start" menu, click "Default Programs", click "Associate a file type or protocol with a program", then click ".sql".

    I had to do all 3 steps before it worked for me. Also, if you use other file extensions for t-sql files (like ".trg" for trigger scripts, etc.) then you will need to repeat step #3 for each extension, if you have already completed 1 and 2. Thanks to these 2 posts which got me most of the way there:

    http://stackoverflow.com/questions/1726577/sql-management-studio-wont-open-scripts-on-double-click

    http://www.satola.info/2010/03/10/.sql-files-launch-a-new-instance-of-sql-server-management-studio-instead-of-opening-a-new-query-window-windows-7/

    Good Luck! LOJ

     

    • Proposed as answer by LionOfJudah Friday, July 22, 2011 1:37 PM
    Friday, July 22, 2011 1:33 PM
  • Sorry for not replying to this thread earlier, LionofJudah. Must have missed the notification.

    Anyway, thanks for the update on this issue.


    Ramesh Srinivasan | The Winhelponline Blog
    Microsoft MVP, Windows Desktop Experience
    Friday, July 22, 2011 4:59 PM
  • Thank you so much. It was extremely annoying dragging and dropping the file into SSMS to get it to open on one instance. I followed your instructions and Viola! It worked. Thanks again!
    Wednesday, August 31, 2011 8:30 PM
  • Thanks a lot.  I had the same problem.  Above three steps resolved it. 
    Friday, May 18, 2012 8:17 PM