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)
 openquery syntax problems

Author  Topic 

wotrac
Yak Posting Veteran

98 Posts

Posted - 2006-05-25 : 17:15:36
I am trying to extract data from a remote progress database.
I have successfully created a linked server and can return data using transact sql.
Howvere I wish to set up a join between two remote tables (the source data) and a local table and am having trouble getting the correct syntax. Could anyone assist at all please.

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-26 : 03:39:15
You probably don't want to do that.
It will have to transfer all the data to perform the join.

Better to transferthe data yourself.
Insert into a temp table from the emote system to join to your local data and include in the openquery statement any filters that you can.

==========================================
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-05-26 : 06:11:50
To extend what nr says,

Instead of

Select columns from table1 t1 inner join LindedServer...table t2 on t1.col=t2.col

use

Create table #temp(col.......)

insert into #temp
Select columns from Linkedserver...table

Select columns from table1 t1 inner join #temp t2 on t1.col=t2.col




Madhivanan

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

wotrac
Yak Posting Veteran

98 Posts

Posted - 2006-05-26 : 12:53:50
I understand where you are both coming from, but the local table is being used as an audit of rows transferred . I don't have anything on the remote server to use as a filter, so will have to bring back a complete recordset every time, as far as I can see. That is unless you have any other ideas.
Go to Top of Page
   

- Advertisement -