Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble adding field to table in specific position
Message
From
01/04/2004 10:18:50
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00891465
Message ID:
00891479
Views:
19
>We have to have a table with fields in a specific order to upload to a mainframe. The field names do not matter, just the location of the fields. I want to be able to take any table that has 52 fields with each having the correct data type and size and add 4 fields to it in a specific place. I looked a the FAQ and one answer I found referred to a bubble sort but that is to complicated for the number of fields. The problem is other table fields may have different names and record size is too large for an array (which is what got me here in the first place). I currently use SQl with space() as fieldname to add fields, into array and append from array, but data is too large for array. Any ideas?
>
>Thanks, Chuck

Chuck,
Data itself might be large for an array but structure is never. Create a cursor from an array where you set the field order as you like and do an append from, copy to.
Or even utilize 'set fields to ...' command. ie:
use customer
Set fields global
set fields to company,;
    cust_id,;
    myCalculated=MaxOrdAmt/5
browse
Also after a select (readwrite cursor) you might use alter table to add,drop,rename columns.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform