Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Turning the tables
Message
From
24/01/2017 09:54:33
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
23/01/2017 20:28:16
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2016
Network:
Windows Server 2016
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01646970
Message ID:
01646983
Views:
52
>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform