>I am creating a new table from an existing table with the following SQL
>statement:
>
>SELECT UPSINO AS equipnum, EQUIP_TYPE AS apprtype, MANUFACTUR AS mfr, ;
>SERIAL_NO AS serialnum, SUB_NAME as location, 'OILTRN' as rules ;
>FROM CNAME INTO DBF cnamecnv.dbf ORDER BY UPSINO
>
>I am creating a comma-delimited file from the new table, cnamecnv.dbf, with
>the COPY TO command as follows:
>
> COPY TO ALIAS()+".txt" TYPE DELIMITED
>
>However, I need the first record of the TXT file to contain the field names
>of the table used to create the TXT file so it will import into my other
>application correctly.
I don't know what is your other application but here's a scenario, that if applicable, might be better.
Do you SQL as is. Then, from your other application, use the IMPORT feature to import directly from the table your SQL has created.
Or, if this is not possible, you may want to try doing the same but to add an additional step which will created a secondary text file which will hold the field headers and the current TXT just created. For that, you may use the low level file functions to create a new file, create the first lines as the header line and copy the TXT file into that one.