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
 Other Forums
 Other Topics
 Join 2 tables from 2 different server?

Author  Topic 

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-08-29 : 17:17:46
Is it possible to join 2 tables from different server in Query Analyzer or VS 2003? The report I'm converting it to is from Crystal report into Reporting Services. What it looks like is that one table is from SQLBase in a different server and another is in SQL Server. The one in the SQLBase does our payroll, but the code(Primary/Foriegn Key) that it reference is from our production application. So the two can be join in Crystal Report.

Just wondering how this would be possible in VS2003 or Query Analyzer. Any ideas?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-29 : 17:21:10
Yes you can do this via a linked server. You'd go to the SQL Server and setup a linked server that references your SQLBase ODBC driver. Once that is setup, then you can reference the SQLBase tables via their four part naming convention:

LinkedServerName.DBName.SchemaName.ObjectName

If I recall right, the SchemaName would be sysadm.

Tara
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-08-29 : 17:47:37
Thanks. That will help. I was thinking about pulling the records from SQLBase into a temp in query analyzer and then create a SP in query analyzer to use parameters to get what I want.
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-08-29 : 18:09:55
Tara,

How would I remove the linked servers in enterprise manager? I added it in there, but I want to be able to remove it also. Can you let me know how to go about doingt this.

Thanks.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-29 : 18:12:09
Highlight it and hit delete on the keyboard.

Tara
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-08-30 : 09:18:50
I did that but I got this msg:


Deleting a remote server deletes all remote logins defined for that server. Are you sure you want to delete linked server PAYROLL and all remote logins defined for this server?


Does this affect the existing server or not? I have not create any remote logins within the linked server yet.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-30 : 12:34:36
If you haven't created remote logins, then it doesn't affect you as the error message indicates.

Tara
Go to Top of Page
   

- Advertisement -