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 |
Daniel Israel
Starting Member
15 Posts |
Posted - 2006-11-16 : 13:17:53
|
I have 2 different databases on my server. I've logged in and I have access to both. Is there a way to access tables from both databases in a single query?In Database A, I have table XIn Database B, I have table YI'd like to do a select by joining tables X and Y.Is this possible?Thanks.-D. Israel |
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2006-11-16 : 13:30:25
|
Reference the table using 3 part names:DatabaseName.Owner.ObjectNameselect YourColumnfrom DatabaseA.dbo.TableX xinner join DatabaseB.dbo.TableY yon x.YourColumn = y.YourColumnNathan Skerl |
 |
|
Daniel Israel
Starting Member
15 Posts |
Posted - 2006-11-16 : 15:54:36
|
Forgot the owner! DOH!Does this work on 2000, or just on 2005?Thanks.-D. Israel |
 |
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2006-11-16 : 16:02:25
|
Should be fine in both.Nathan Skerl |
 |
|
|
|
|