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

Re: Pass back values from a SQL statement



"as fieldone"  is not proper syntax for SQR.
Try

select [$fieldname]  &fieldone=char



> -----Original Message-----
> From: Denise Goin [SMTP:Denise_Goin@PARAMOUNT.COM]
> Sent: Wednesday, April 03, 2002 5:09 PM
> To:   SQR-USERS@list.iex.net
> Subject:      Pass back values from a SQL statement
>
> I ahve a procedure where I am building pretty much the entire thing from
> dynamic clauses.  I have a dynamic value for the field I am selecting, a
> dynamic value for the record it is selecting  from and a dynamic where
> clause.  No getting around this....... it will not work with a
> begin-select, but it does work with a begin-sql.  This is because of the
> dynamic value in the place of the field name being selected (I think).
>
> Now I need to know if there is anyway to pass back the value of the field
> I am selecting from a begin-sql?  I have tried giving it an alias and
> trying to access the alias after the end-sql and the program doesn't
> recognize it.  I am attaching the snippet of code below.  Pasting the
> values into the dynamics I can make this code run against the database,
> and the alias works there.  What I need to do is pass back fieldone into
> my SQR program, to use in the next procedure.  Any suggestions?
>
> begin-procedure GET-VALUES
> begin-sql
> select [$fieldname] as fieldone
> FROM [$FROM]
> where [$WHERE]
> end-sql
> end-procedure GET-VALUES
>
> The SQL statement ends up looking like:
> select EMPLID as fieldone
>
> FROM PS_AUDIT_Z_PERSDTA
> where AUDIT_STAMP > '2002-02-20'
>
> Thanks in advance,
>
> Denise