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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 join two database

Author  Topic 

maneesh_bat
Starting Member

1 Post

Posted - 2008-09-22 : 02:56:16
my question is how to join two databases on same server and also different server?

suppose there is one table emp in x table
structure:
id bigint
name varchar(50)

and there is another table salary in y database
structure
id bigint
salary int

both databases are on same server.

how to join these two tables in two different databases so that i could get id,name and salary in one record set?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-22 : 03:36:06
On same server, use four-part naming convention.
On different server, use linked server with four-part naming convention.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-22 : 04:01:50
quote:
Originally posted by maneesh_bat

my question is how to join two databases on same server and also different server?

suppose there is one table emp in x table
structure:
id bigint
name varchar(50)

and there is another table salary in y database
structure
id bigint
salary int

both databases are on same server.

how to join these two tables in two different databases so that i could get id,name and salary in one record set?


use db.schema.tablename in join
Go to Top of Page
   

- Advertisement -