Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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
( FORWARD TO server2 { sql-statement }  ) as b
on =


asked 25 Mar '14, 11:08

sqlgeek's gravatar image

accept rate: 0%

edited 25 Mar '14, 11:08

From the docs:


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

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 25 Mar '14, 11:08

question was seen: 2,329 times

last updated: 25 Mar '14, 14:14