RE: Query tables across multiple databases with sql
From: Eric (Eric_at_discussions.microsoft.com)
Date: 08/25/04
- Next message: Eric: "RE: SqlConnection timeouts not expiring"
- Previous message: mklapp: "RE: Strange behavior from ADODB and SQL Server"
- In reply to: chris: "Query tables across multiple databases with sql"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Aug 2004 12:05:03 -0700
Chris, what you are talking about is 2 databases on 2 different servers? If
so, you need to add server B as a linked server on server A. You can do this
from Enterprise manager or Query analyser. From EQ manager go to the database
and look for "Security" and then "linked servers". From here, add server "B"
as a linked server. (see BOL for more detail). Once you have the likned
server "B" on server "A", you can then run query from server "A" to "B" with
the dot notation. You can also join a table on server a with B. Example from
server A:
SELECT *
FROM servername.databasename.dbo.tablename
good luck, Eric
> Hello:
>
> How do I write an sql statement to link tables in two databases and query
> them?
> For example:
>
> SELECT db1.table1.field1, db2.table1.field1 FROM Table1 INNER JOIN
> db1.table1.field1 ON db2.table1.field1 = db1.table1.field1
>
> This is for SQL Server 2000. Thank you.
>
- Next message: Eric: "RE: SqlConnection timeouts not expiring"
- Previous message: mklapp: "RE: Strange behavior from ADODB and SQL Server"
- In reply to: chris: "Query tables across multiple databases with sql"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|