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)
 Query among SQL Servers

Author  Topic 

db_sysadmin
Starting Member

27 Posts

Posted - 2006-07-27 : 11:36:05
Hi there,

I need to join two tables among two different databases, located in different SQL Server 2000 SERVERS.

Like Select * FROM Server1.Customers INNER JOIN Server2.Customers On ....

Any Suggestions?

Thanks a lot!

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-27 : 11:45:30
Like
Select * FROM Server1.db1.dbo.Customers INNER JOIN Server2.db2.dbo.Customers On ....

You won't need the server/database for the server that you are running it on.
Note this is a really bad thing to do for any sizable amount of data as it will have to transfer the data to one of the servers to do the join. Better to maintain a copy of the data locally.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-27 : 12:08:58
Also you need to make use of Linked server to make that query works

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-07-28 : 01:51:25
Madivanan, do u have any link for this topic so that i can get more information regarding to LINKED SERVER QUERIES?

thanks in advance,

Mahesh
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2006-07-28 : 02:08:02
Books Online is your friend! Search for "Linked servers" in the index and you'll find plenty of info. http://www.sql-server-performance.com/linked_server.asp can also give you some great pointers...

--
Lumbago
"Real programmers don't document, if it was hard to write it should be hard to understand"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-28 : 09:05:41
As said, SQL Server help file has details. Look for it

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -