Opening .sql in SSMS - R2

  • Hi all,

    I have associated .sql files to open using SSMS.

    When I double-click on an .sql file, and SSMS is not already open, I must choose the server to which I want to connect.

    But, when SSMS is already open, the query window opens connected to the last server against which I last ran a query.

    I would like always force the choice of a server. I've tried to find such a setting and registry entry without success.

    Is there a way?

    Thanks!

  • Been discussed here lately and IIRC there's no way.

  • I also recall that there is no way to do that. I'd love to be wrong on it though:-D

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQLRNNR (8/9/2011)


    I also recall that there is no way to do that. I'd love to be wrong on it though:-D

    Same here, the thread had like 100 answer. I skimmed most of it but there where still trying to hack there way into doing that so there's obviously no easy way.

    I remember the mention of projects which would then connect to the correct server but that was also a PITA.

  • Ninja's_RGR'us (8/9/2011)


    SQLRNNR (8/9/2011)


    I also recall that there is no way to do that. I'd love to be wrong on it though:-D

    Same here, the thread had like 100 answer. I skimmed most of it but there where still trying to hack there way into doing that so there's obviously no easy way.

    I remember the mention of projects which would then connect to the correct server but that was also a PITA.

    Now that you mention Projects, I would say that is more feasible than other attempts. The project will still try to connect the script you are opening to the last server that script was opened against.

    I like projects for other reasons - and would rather deal with that PITA, than the PITA of MS forcing patches and being rebooted in the middle of the day, then having to relocate all of the files I was working on. 😉

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • schleep (8/3/2011)


    Hi all,

    But, when SSMS is already open, the query window opens connected to the last server against which I last ran a query.

    Thanks!

    Even when you have SSMS Opened

    When you double click on .sql it always pops up the connection manager and propmts for Userid and password or Windows authentication?

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • @SQLFRNDZ (8/9/2011)


    schleep (8/3/2011)


    Hi all,

    But, when SSMS is already open, the query window opens connected to the last server against which I last ran a query.

    Thanks!

    Even when you have SSMS Opened

    When you double click on .sql it always pops up the connection manager and propmts for Userid and password or Windows authentication?

    He is saying that when SSMS is already open and connected, opening a new .sql file automatically connects without prompt for UID and pass. He would like it to prompt.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • No it doesn't, and that's the problem.

  • I also remember this tool being mentioned. It changes the background color depending on the server you're connected to.

    It could save some heartache if used properly.

    http://www.ssmstoolspack.com/

  • SQLRNNR (8/9/2011)


    @SQLFRNDZ (8/9/2011)


    schleep (8/3/2011)


    Hi all,

    But, when SSMS is already open, the query window opens connected to the last server against which I last ran a query.

    Thanks!

    Even when you have SSMS Opened

    When you double click on .sql it always pops up the connection manager and propmts for Userid and password or Windows authentication?

    He is saying that when SSMS is already open and connected, opening a new .sql file automatically connects without prompt for UID and pass. He would like it to prompt.

    Actually it deos prompt,

    Step 1: When we open first .sql say Microsoft.sql then it opens up the management studio and prompts for Authentication

    Step 2: Not Closing the SSMS but the files opened

    Step 3: Open the second file say Microsoft2.sql then it is prompting for Authentication where we can change the server name too.

    Note : If we don't close the file1 and opening the second file is taking the default connection already opened as file1.

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • @SQLFRNDZ (8/9/2011)


    SQLRNNR (8/9/2011)


    @SQLFRNDZ (8/9/2011)


    schleep (8/3/2011)


    Hi all,

    But, when SSMS is already open, the query window opens connected to the last server against which I last ran a query.

    Thanks!

    Even when you have SSMS Opened

    When you double click on .sql it always pops up the connection manager and propmts for Userid and password or Windows authentication?

    He is saying that when SSMS is already open and connected, opening a new .sql file automatically connects without prompt for UID and pass. He would like it to prompt.

    Actually it deos prompt,

    Step 1: When we open first .sql say Microsoft.sql then it opens up the management studio and prompts for Authentication

    Step 2: Not Closing the SSMS but the files opened

    Step 3: Open the second file say Microsoft2.sql then it is prompting for Authentication where we can change the server name too.

    Note : If we don't close the file1 and opening the second file is taking the default connection already opened as file1.

    You are missing the key pieces of information. Bolded for reference.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Yes that true , I'm not missing that

    SSMS is OPEN and CONNECTED,

    I'm telling that it prompts when you close first opened file(Query Analyzer) and open the Second .sql file

    in this case I'm not closing the ssms and staying connected to one of the server.

    I have difficulty in explaining I guess.

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • The requirement is also NOT to close the currently opened windows.

    There's a reason that debate lasted over 100 posts in that other thread. There's no simple, easy solution ;-).

    I'm opened to other ideas, but I have none atm.

  • Wow.

    Glad to see I'm not the only one who wishes it wasn't made so easy for us to make a Really. Bad. Mistake.

    Hey Microsoft: Can we PLEASE have Query Analyzer back? Apart from solving the current problem, it opens several orders of magnitude faster than SSMS, and uses a ton less memory.

    Thanks to all for the responses.

    P

  • using "Database Engine Query", either from the button in tool bar or the file menu, will cause the prompt when subsequently opening .sql files. This will only persist for the current session of SSMS. Once you close SSMS, you will have to open at least one query with "Database Engine Query".

    Bob
    -----------------------------------------------------------------------------
    How to post to get the best help[/url]

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

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