llOK = .T. * Pre -- ensure that cCodes are unique or else you'll get an error * creating the table. SELECT cCode FROM mySourceTable GROUP BY cCode HAVING COUNT (cCode) > 1 llOK = (_TALLY = 0) IF llOK * Generate a file skeleton for the new table. SELECT cCode, "C" AS cFieldType, 5 AS nFieldLen, 0 AS nFieldPrec ; FROM mySourceTable ; INTO ARRAY lamyFileStructureArray llOK = BETWEEN (ALEN (lamyFileStructureTable, 1), 1, 255) ENDIF * Create the new table IF llOK CREATE TABLE MyNewTable FROM lamyFileStructureArray SELECT MyNewTable APPEND BLANK && Add the one new record needed for the new structure. * Store the old values into the proper place in the new table. X = 1 SELECT mySourceTable SCAN lcFieldName = "MyNewTable." + ALLTRIM (FIELD (X)) REPLACE (lcFieldName) WITH mySourceTable.cValue IN MyNewTable X = X + 1 ENDSCAN ENDIF