I want to use forward statement as sub-query but obviously it fails.
what is the best way to handle this? both servers are sybase IQ.

select * from table1 a
join
( FORWARD TO server2 { sql-statement }  ) as b
on a.id = b.id

Thanks

asked 25 Mar '14, 11:08

sqlgeek's gravatar image

sqlgeek
1477713
accept rate: 0%

edited 25 Mar '14, 11:08


From the docs:

Note

The FORWARD TO statement is a server directive and cannot be used in stored procedures, triggers, events, or batches.

It is used to send a complete SQL statement (or several ones) to a remote server. Therefore, you cannot use it as part of a query.

However, what you are trying to do can be done with proxy tables - they are "linked remote tables" that can be used within queries with local tables - though there are some performance implications.

permanent link

answered 25 Mar '14, 11:30

Volker%20Barth's gravatar image

Volker Barth
40.2k361549822
accept rate: 34%

edited 25 Mar '14, 11:36

can it at least insert the result of query from server2 to a temp table? and then join to temp table?

I try to avoid proxy table. Basically, we have two sybase IQ servers which have same db schema and should have the same data in some tables. We want to compare data easily and make sure server2 has all the data. I want to left outer join server2 result to check if any data is missing on server2. I don't want to create too many proxy tables just for this.

(25 Mar '14, 11:44) sqlgeek
Replies hidden
1

Then you may have a look at that question:

How can I compare data from proxy tables and local tables?

(25 Mar '14, 12:21) Volker Barth
Comment Text Removed
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×41

question asked: 25 Mar '14, 11:08

question was seen: 2,301 times

last updated: 25 Mar '14, 14:14