-1

I would like toalter the table to move fields from one place to another.

ABS1
ABS2
ABS4
ABS8
ABS3

So I would like to move ABS3 after ABS2, but not move the physicly. Would like the code do it for me.

Comintern
  • 21,855
  • 5
  • 33
  • 80
  • Unclear what you are asking. Are these individual rows in a table, data columns, OR the values within the columns on a row. If you are just trying to sort the data, look into indexing. Please clarify otherwise. – DRapp Sep 30 '16 at 13:21
  • Would like to move columns –  Sep 30 '16 at 13:36
  • Not just sort, I would like to move permanently ( As Modify Structure will do) –  Sep 30 '16 at 13:36
  • So why won't sort do the job? – Andy Wynn Sep 30 '16 at 13:47
  • 2
    Please don't do that. There is no purpose in doing so. Anytime you can select the data in the column order you like to, if ever need be. Anyway adding an awkward way to accomplish it. – Cetin Basoz Sep 30 '16 at 14:15

1 Answers1

2

Assuming that table is named "mytable.dbf" and you have exclusive access:

select * from mytable into table tmp
use in ('myTable')
erase ('myTable.dbf')
*    erase ('myTable.fpt')
*    erase ('myTable.cdx')
select ABS1, ABS2, ABS3, ABS4, ABS8 from tmp into table myTable

and then recreate the indexes as well.

Cetin Basoz
  • 22,495
  • 3
  • 31
  • 39