Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Table from Array 1

Status
Not open for further replies.

KALEMO

Programmer
Joined
May 7, 2002
Messages
5
Location
US
I have an array that is storing only field names and now need to create a table where the field names in the table are the same as the field names in the array.

I've tried altering an existing table using
ALTER TABLE CTRAC;
RENAME COLUMN FIELD7 TO laCTRAC[1,7]

and have tried
CREATE TABLE CTRAC;
(laCTRAC[1,1] C(12),;
laCTRAC[1,2] C(3),;
laCTRAC[1,3] C(20),;
laCTRAC[1,4] C(10),;
laCTRAC[1,5] N(3),;
laCTRAC[1,6] N(5))

neither worked. Help, please and thanks!
 
Try using macrosubstitutions:

CREATE TABLE CTRAC;
(&laCTRAC[1,1] C(12),;
&laCTRAC[1,2] C(3),;
&laCTRAC[1,3] C(20),;
&laCTRAC[1,4] C(10),;
&laCTRAC[1,5] N(3),;
&laCTRAC[1,6] N(5))

or

ALTER TABLE CTRAC;
RENAME COLUMN FIELD7 TO &laCTRAC[1,7]
 
Look at the AFIELDS() function. If you restructure your existing array so that it contains the data created by AFIELDS() then you can use the CREATE TABLE FROM ARRAY command.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top