Posted on 2005-03-08
Medium Priority
Last Modified: 2012-08-13
Can someone show me how too join from 2 different databases as opposed too 2 different tables in one database

The databases i want to join are dbo.tblfall_Details on database A to tblEnd_Details on Database B
The field i want to join is tblFall_Details.aby to tblEnd_Details.userID

Nb userid is a primary key, whereas aby isnt!

Thanks in advance
Question by:paulo111
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 43

Accepted Solution

TimCottee earned 1500 total points
ID: 13486239
Hi paulo111,

Select A.*, B.* From DatabaseA.dbo.tblFall_Details A Inner Join DatabaseB.dbo.tblEnd_Details B On A.aby=B.userID

Tim Cottee

Expert Comment

ID: 13486436

The technique is the same regardless, simply add the database parameter to the four part object naming convention.


So you see, if you have set up linked servers, you can easily join tables on different servers in the same way!! (cool eh?)

One caveate when going across databases (or servers!) is that you could encounter collation issues, if the databases have different collations.

One way around this is to use the "collate database_default" directive right after each join expression.


Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question