Fill a temp-table using sql statement. Is it possible

bigwill

Member
Hi all

Quick question. I am working on a c#/appserver "GetRecords" test project

Is it possible to fill a temp-table using sql-select statement (that i pass in as parameter ?

For instance:


Code:
def temp-table tt like customer.

select * from customer where c-name like 'Nor%'.

create tt.

buffer-copy customer to tt.

i also tried to use query:
Code:
  def var qh as handle.
  CREATE QUERY qh.
  qh:SET-BUFFERS(buffer customer:handle).
  qh:QUERY-PREPARE("select * from customer where c-name like 'Nor%'").
  qh:QUERY-OPEN().
  qh:GET-FIRST(no-lock).
  do while not qh:query-off-end:
    
    create tt.
    //Fill
    
    qh:GET-NEXT().   
  end.
 
  qh:query-close().
  delete object qh.
I have no problem using normal progres syntax "for each ....", but i am exploring sql select statements. Any Ideas ??
 

RealHeavyDude

Well-Known Member
Every SQL statement that is executed in the AVM is SQL89. Full Stop. It is not real SQL - it is some form of psydo SQL interpreted by the AVM.
 

tamhas

ProgressTalk.com Sponsor
I.e., if you are in a context where you can use SQL-92, you have no temp-tables.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
I have no problem using normal progres syntax "for each ....", but i am exploring sql select statements.
To what end?

for each works and is supported. And either way you are running a query in the 4GL query engine, not the SQL-92 query engine.
 

Casper

ProgressTalk.com Moderator
Staff member
since you work on a C# project: it is possible to fire queries directly on the progress database from .NET.
Depending on the goal you wish to achieve this might or might not be a viable option.
I prefer sql to not run on the production database.
 
Top