*********************************************************** * function: * MakeTempTable * * parameters: * tcTarget - table to be updated (character) * * abstract: * Create a temporary table with the same structure as * tcTarget and return the temporary table's name. *********************************************************** function MakeTempTable ( tcTarget ) set step on do case * two parameters are required case pcount() < 1 return TOOFEWPARMS case vartype(tcTarget) != 'C' or empty(tcTarget) return NOTARGETPARM endcase * make consistent tcTarget = upper(alltrim(tcTarget)) local array laDBObjects[1] local lnDBObjectCount lnDBObjectCount = adbobjects( laDBObjects, "TABLE" ) if ascan( laDBObjects, tcTarget ) = 0 return NOTARGETTABLE endif select 0 use ( tcTarget ) again alias TargetTable local array laFields[1] local lnFieldCount, lcTableName lnFieldCount = afields( laFields ) lcTableName = sys( 2015 ) && generate unique name laFields[1, 12] = lcTableName use create table ( lcTableName ) from array laFields use return lcTableName endfunc