to join tables from different databases in sql server 2000


You have to just qualify the table names in your SELECT queries with database name, followed by table owner name. In the following example, Table1 from pubs database and Table2 from northwind database are being joined on the column i. Both tables are owned by dbo.



SELECT a.i, a.j

FROM pubs.dbo.Table1 a

INNER JOIN

northwind.dbo.Table2 b

ON a.i = b.i

GO



Added on January 8, 2008 Comment
}