Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select from other db.

Author  Topic 

mrjack
Yak Posting Veteran

50 Posts

Posted - 2006-06-08 : 04:32:13
Hi Guys,

i tried to google but cant find the ans, hope u guys can help me out.

what i want to do is to use a select statement with table from other db...such as

select * from table1 a,(table from other db) b
where a.col1=b.col1
and a.col2=b.col2

thanks guys..

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-08 : 04:41:16
[code]
select *
from table1 a inner join db2..table2 b
on a.col1 = b.col1
and a.col2 = b.col2
[/code]


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-08 : 06:00:16
or specify Owner
select *
from table1 a inner join db2.Owner.table2 b
on a.col1 = b.col1
and a.col2 = b.col2


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -