Query across Databases

  • I have 6 databases open under one instance of SQL-2005. Is it possible to query across databases ? When I open a query, I connect to the main database. However, to link to a table in one of the other databases (the others are change logs), I have to reconnect to that other database, and I lose the connection to my main database.

    Thank you !

  • You can query across database using three part naming. For example:

    SELECT * FROM Database.Schema.Table

    Greg

  • You can query with a 3-part name:

    Database.ObjectOwner.Object

    Also, you can create a synonym in your database that refers to an object in another database.

Viewing 3 posts - 1 through 2 (of 2 total)

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