Trying to understand how to access SysDatabases

  • I am new to SQL Server and am confused about how to change between databases. Heres my problem.

    I have 3 different databases connected in Management Studio. One is in SQL Server 2000, One is in SQL Server 2005, One is in SQL Server 2008 Express.

    I am trying to figure out how to switch between the 3 databases so that I can write queries and stored procedures on each.

    here are the names- WIN-NCBE1C3T57L, 01AL10015000450\CONSMETRIC, & GACDTD01GP133E\SQLEXPRESS.

    I was trying to issue a USE WIN-NCBE1C3T57L.CUSTOMER command but that didn't work because it can't get past the WIN- part of the command.

    Can someone tell me how I can switch between the three databases listed above using the use command to be able to access the tables in the Query window?

    Thanks for any help, I'm really new at this.

    Greg

  • gregory.perry2 (5/6/2010)


    I am new to SQL Server and am confused about how to change between databases. Heres my problem.

    I have 3 different databases connected in Management Studio. One is in SQL Server 2000, One is in SQL Server 2005, One is in SQL Server 2008 Express.

    I am trying to figure out how to switch between the 3 databases so that I can write queries and stored procedures on each.

    here are the names- WIN-NCBE1C3T57L, 01AL10015000450\CONSMETRIC, & GACDTD01GP133E\SQLEXPRESS.

    I was trying to issue a USE WIN-NCBE1C3T57L.CUSTOMER command but that didn't work because it can't get past the WIN- part of the command.

    Can someone tell me how I can switch between the three databases listed above using the use command to be able to access the tables in the Query window?

    Thanks for any help, I'm really new at this.

    Greg

    You have three servers, not three databases. You cannot use the 'USE' statement to change servers. You must open up a new query window to access a new server*

    *Yoiu can use linked servers, but I beleive that is beyond the scope of your knowledge and experience at this point.

    /* ----------------------------- */
    Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

  • Thank you so much. I see that I need to open a new Query window. That worked great! Thanks

  • Your welcome

    /* ----------------------------- */
    Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

  • Also, if you don't want to open a new query window, but just switch the connection in the one you're on, you can click the icon that's in the upper left of the tool bar (by default) called Change Connection. It looks like two little computers connected with a red x between them.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 5 posts - 1 through 4 (of 4 total)

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