Being simple minded, I am having trouble with this: I want to do a query of a table say the table has Field01, Field02, Field03,....Field25. I have to export this data to a CSV file that will be imported into a AS/400, but because the AS/400 uses proprietory software, where the fiields for import are predefined, I have to adjust my server data to conform to the AS400 Structure. This means for each record I must add or insert fields prior to exporting to a CSV file. I can do the query no problem, I can create fields no problem but how do I order the fields the way I want them per row, and then write it to a csv file. Oh did I say that I have to also add data fields for each row. I can guess that this requires a function that includes a query per row based upon a selection and then adding the new fields, end the row and the function, write the row and go on to the next row. Is this right?