>Hi All,
>
>Is there a way to programmatically re-order the columns in a table? I want to export the table to an Excel sheet in a user-defined order.
>Thanks.
>
>Luke
In a SELECT - SQL statement, you can define both the order of the records, and the order of the fields. You can also specify which fields (and which records) to include in the result. Example:
select LastName, FirstName;
from Customer;
where Active;
order by LastName, FirstName;
into cursor Temp
Then you can use that cursor to copy to an Excel file (copy to ... type xls), use Automation to copy one field at a time, etc.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)