SSMS - always open file with new connection

  • After i run a query in server A, database X, then open a .sql file, two things may happen:

    1 - the file is automatically opened with latest active connection (server A, database X)

    or

    2 - SSMS prompts for server name ('Connect to Server' dialog box)

    Is there a Registry Key configuration to make SSMS do (2) each time, instead of (1) ?

    P.S: (1) happens if ObjectExplorer/Query is open, (2) happens if a MaintenancePlan is open

    Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)

  • <bump>

    where can i get explanations for what each registry key does ?

    i tried setting this to 0, but new files still open with current connection:

    HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell\General\ReuseActiveDocumentWindow

  • Thanks for the link - I voted for your request and added a comment to suggest how Microsoft might implement this.

    The auto-connect feature has been a pain in my neck.

  • <bump>

    thanks jeff.. (& others) who voted on https://connect.microsoft.com/SQLServer/feedback/details/555557/ssms-open-file-with-active-connection-or-prompt-connect-to-database-engine

    but no response from M$ yet..

    to remind people of issue: when you work on multiple servers and double-click an .sql script, SSMS automatically opens using active server connection (earlier it used to prompt).

    just a curious Poll on how people deal with this?

    1. i open file in active server connection & 'Change Connection' later

    2. i first go to desired server connection & then open file

    3. i have multiple SSMS windows, one for each server connection (thus (2) becomes bit easier)

    4. i vent so much they change my title from dba to bad

    5. phoo! what your company achieves with multiple servers, mine achieves in (n)one !

    while here, i want start another poll on most disastrous SQL Server design decisions?

    1. make Ctrl-E hot-key for Execute - right next to Ctrl-R, Ctrl-S, Ctrl-D, Ctrl-F, Ctrl-W

    2. put Execute button right next to Save,Open,Parse,Choose-Database,Auto-Hide

    3. automatically open files in active server connection

    4. limit sp_helptext column width to 255

    5. 'Any changes take effect only in New Query Window'

  • First Poll Answer: 1

    I've been much more cautious when clicking "F5" - and I close any active connections to the more worrisome environments (ie, prod) as soon as I can do so.

    Second Poll Answer: 3

    For the first and second options, I use F5, so I've never accidentally hit Ctrl-E. I rarely run into the scenarios mentioned in options 4 and 5.

    I was excited when I started using SSMS 2008 - had high hopes that something was done to correct the issue, but no dice. Sad.

  • There is a way to do this. Open SSMS as usual. Click on "Database Engine Query". It's right next to "New Query". Cancel out of that. Then every time a .sql file is dropped onto SSMS query window, a new connection is required.

Viewing 8 posts - 1 through 7 (of 7 total)

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