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
 Transact-SQL (2000)
 joining tables from different servers

Author  Topic 

mkp2004
Starting Member

8 Posts

Posted - 2004-06-02 : 14:20:17
I need to query the data from 3 tables in 3 different servers.Basically a union of these 3 tables.please help me out

10.50.200.139 (server),order(database),table1
10.50.200.139\CIG (server),product(database),table2
10.50.100.142 (server),sales(database),table3

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-02 : 14:22:22
You'll need to create two linked servers on one of the database servers. The two linked servers would reference the other two. Then use the 4 part naming convention with the linked server for your query.

Linked servers can be configured in Enterprise Manager under security. You can use an alias for the linked server, but the alias must be configured on the database server where the linked server is created. I mention aliases since you have posted IP addresses and may not be able to resolve the host name.

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-02 : 14:32:08
Are they small? If not don't do it.
The union will cause all data to be transferred to one server anyway. Better to transfer the tables yourself and do the processing 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

X002548
Not Just a Number

15586 Posts

Posted - 2004-06-02 : 14:42:33
I think Nigel means bcp the data out then either bulk insert or bcp in to the destination db...

How much data we talking about?



Brett

8-)
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-02 : 14:51:26
Depends on the situation. If this is ongoing thing then add jobs to do an incremental copy so that you aren't impacting the servers. Has the bonus that you will have data if the other servers aren't accessible.

==========================================
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

mkp2004
Starting Member

8 Posts

Posted - 2004-06-02 : 17:05:52
There is a lot of data and I want to query different the tables sitting at different servers and then need to actually join with an id so that i get the result as needed by the criteria
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-02 : 18:08:54
As I said that will transfer the data to one server to perform the join - if it's not a once off thing you can kill both servers and the network by doing that.

==========================================
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
   

- Advertisement -