April 7, 2004 at 8:25 am
We have 2 databases on 1 SQL server. Is there a way to link the tables between these two databases in 1 select statement? If so, what is the syntax.
Thanks ahead for any help.
April 7, 2004 at 9:15 am
Do you mean to select from both, or run a join?
SELECT A.COL1, B.COL2 FROM DB1.DBO.TABLEA A, DB2.DBO.TABLEB B
SELECT A.COL1, B.COL2 FROM DB1.DBO.TABLEA A INNER JOIN DB2.DBO.TABLEB B ON A.COL1 = B.COL1
April 7, 2004 at 1:17 pm
Thanks for your reply, we figured it out.
Database A (main database)
Database B (secondary database)
We were leaving out the dbo name from database B when we initially were trying to do the query.
It works if we:
select a.table, b.dbo.table
from a, b
where a.column = b.column
April 8, 2004 at 6:32 am
That darn table owner will get you every time! Makes you wonder if it's outlived it's usefulness and should be eliminated in a future SQL server version?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply