[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



Denise,

dynamic columns should not present a problem.   Have you tried something
like...

begin-select
[$fieldname] &fieldone=char
   show &fieldone
FROM [$FROM]
where [$WHERE]
end-select

It does need the &xxx to know where to store it, and the =char (or =date
or =number) to know what type will come out.

HTH,


On Wed, 3 Apr 2002, Denise Goin wrote:

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

-----------------------------------------------------------------------
Donald Mellen  | Ray Ontko & Co. - Richmond, IN - http://www.ontko.com/
donm@ontko.com |  "In the beginning, there was nothing, which exploded"