January 7, 2010 at 5:22 am
plz help me..........
March 24, 2010 at 5:36 am
Are you still looking out the answer for this.?
Below is a sample query to join two tables present in two different databases of the same server.
select a.* from DB1.dbo.[Table] a
inner join DB2.dbo.[Table] b
on a.[Col]=b.[Col]
March 29, 2010 at 9:52 am
Besides using the 3 part name of a table as previous poster indicated (db.owner.table) you could create a view of a table in the current database that selects from the other database. You can then use the view in the joins.
I've read that you can create a view of a table on another server or instance. Make sure that the user has access to both servers (same password if SS login) and use "exec sp_serveroption 'Server\InstanceName', 'data access', 'true'". You would then use a 4 part name (server.db.owner.table).
Steve
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply