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

Re: Add table to select paragraph



     You can try the following code to dynamically specify the table name
     in the select paragraph of the procedure test

     Begin-Program
     Do Init
     Do Test
     End-Program

     Begin Procedure Init
     move '' to $extra_tab
     move '' to $and_clause
     if upper($include_tab_x) = 'Y'
      move 'tab_x' to $table_name
     end-if
     End-Procedure

begin-procedure test
begin-select
select a, b, c
from [$table_name]
end-select
end-procedure
______________________________ Reply Separator _________________________________
Subject: Add table to select paragraph
Author:  SQR-USERS@USA.NET at INTERNET
Date:    1/15/98 4:10 PM


Hello Gurus!

        Is there a way to add a 'dynamic' table name in a SELECT paragraph?
For example, in the following code, I would like to include a table called
'tab_x' in the selection, only when it is called for ($include_tab_x = 'Y').
        The code below doesn't work:

Begin-Program
  Do Init
  Do Test
End-Program

Begin Procedure Init
  move '' to $extra_tab
  move '' to $and_clause
  if upper($include_tab_x) = 'Y'
  end-if
End-Procedure