[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Dynamic SQL with the FROM clause
- Subject: Re: Dynamic SQL with the FROM clause
- From: Manoj Gurjar <mgurjar@HOTMAIL.COM>
- Date: Mon, 2 Oct 2000 13:49:20 EDT
use [ ] as :
FROM [$tablename] ! this is possible!!!
>From: Jim Ebert <james_ebert@PEOPLESOFT.COM>
>Reply-To: sqr-users@list.iex.net
>To: SQR-USERS@list.iex.net
>Subject: Dynamic SQL with the FROM clause
>Date: Fri, 29 Sep 2000 12:12:38 -0500
>
>I have a program that has a procedure that repeats itself many times with
>only one difference - the tablename in the FROM clause. I know that SQR
>provides dynamic activity for the WHERE clause, but I couldn't figure out
>if the same is possible for the FROM clause. Here is a chunk of code.
>
>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>begin-procedure Delete ! Main report processing
>if #print=1
>begin-select
>COUNT(IA_ACCOUNT_ID) &count
>FROM $tablename ! Is this possible???
>WHERE BUSINESS_UNIT = $SQR_BU
>AND IA_ACCOUNT_ID = $SQR_POLICY
>end-select
>show 'Deleted ' &count ' rows from ' $tablename
>end-if
>
>begin-sql
>DELETE FROM $tablename ! Is this possible???
>WHERE BUSINESS_UNIT = $SQR_BU
>AND IA_ACCOUNT_ID = $SQR_POLICY
>end-sql
>
>end-procedure !End Delete
>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
>earlier in the program I set the $tablename to the correct table name, but
>if this procedure doesnt work, I have to write this procedure N number of
>times with a different tablename each time. I already tried it, and it
>seems to crash on compile, not during run-time. Please Let me know if
>there is any way to approach this. Thank you.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.