Author: William Gerbert
How to make the results of a query permanent
Answer:
Traditionally, to write the results of a query to disk, you use a TBatchMove and a
TTable in addition to your query. But you can short-circuit this process by making
a couple of simple, direct calls to the BDE.
Make sure you have BDE declared in your uses section
1 procedure MakePermTable(Qry: TQuery; PermTableName: string);
2 var3 h: HDBICur;
4 ph: PHDBICur;
5 begin6 Qry.Prepare;
7 Check(dbiQExec(Qry.StmtHandle, ph));
8 h := ph^;
9 Check(DbiMakePermanent(h, PChar(PermTableName), True));
10 end;