[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Dynamic Query Variables



     Pre-V3 SQR does require a static table name on the left side of a
     dynamic table specification as other respondents have mentioned. After
     V3, the code you have here should work.

     John L. Kellogg
     MITI Tehnical Support Manager

______________________________ Reply Separator _________________________________
Subject: Dynamic Query Variables
Author:  usa.net!SQR-USERS@netcomsv.netcom.com at Internet
Date:    01/03/96 5:39 AM


I am trying to use Dynamic Query Variables in the following way:

Begin-Procedure main

let $from_table='company'

begin-select

co_nbr

from [$from_table]

end-select

End-Procedure main

I receive the following message:

(SQR 5528) Sybase DBSQLEXEC error in cursor 1:
   (156) Incorrect syntax near the keyword 'where'.

SQL: select co_nbr  from  where 1 = 2

Error on line 76:
   (SQR 3716) Error in SQL statement.

Errors were found in the program file.

SQR: Program Aborting.

Why doesen't this work?

The  column co_nbr is a column in the company table.
I tried alot of variations like including the table name in the column
expression company.co_nbr,  using alaises in the from clause. but it still does
not work.
I followed the book line by line and I still cannot understand what is wrong.

Any help would by appreicated.

John Palmieri