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.
| Author |
Topic |
|
ratcho
Starting Member
18 Posts |
Posted - 2002-09-24 : 10:36:26
|
| Hi, all!I have two databases in one SQL Server, for exemple dbA and dbB.Do you think it will be possible to make select from both databases. For exemple:select dbA.TableA.Desc1, dbB.TableB.Desc2 from dbA.TableA, dbB.TableBAnd also, can I make joints between tables which are in two different databases.Thank you a lot for your time and your help. |
|
|
Andraax
Aged Yak Warrior
790 Posts |
Posted - 2002-09-24 : 10:58:16
|
| Sure you can. You are only missing the owner reference:select dbA.dbo.TableA.Desc1, dbB.dbo.TableB.Desc2 from dbA.dbo.TableA, dbB.dbo.TableB ... |
 |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2002-09-24 : 10:59:21
|
| Yes you can. The syntax when specifying a database table is:Server.Database.Table_Owner.TableSo if you have two databases on the same server, you could do the following:Select a.*, b.*FROM db1..Table1 INNER JOIN db2..Table1In this case, since both databases are on the same server, you can leave the server name out. I also assumed that the table owners where the same.Jeremy |
 |
|
|
ratcho
Starting Member
18 Posts |
Posted - 2002-09-24 : 11:06:43
|
| Thanks a lot my friends!You helped me a lot! |
 |
|
|
|
|
|