Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resequence a field, VFP 7,
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00845668
Message ID:
00846612
Views:
27
>>>>>While not a large table about 2000-3000 records it has losts of fields. He asked how hard
>>>>>would it be do re-sequence the fields so they are sequnecial (i.e. nolonger as missing
>>>>>values). Is there an efficent way of doing this? If so what is it?
>>>>
>>>>Would it work for you to make copies of those tables, associate them with a DBC, set cascading
>>>>referential integrity on updates, make your changes, and then copy the data back to the original
>>>>tables?
>>>
>>>My question is once I do that what is the best way to resequence the key field which is defined
>>>as a 9 character field, but is really a nine digit value with leading zeros, i.e. the simplest method
>>>the comes mind is in a SCAN loop start at the first record and for each record replace the
>>>current value of the key field with an integer value converted into a 9 character value with leading
>>>zeros.
>>>
>>>Is this the best approach or is there a better one?
>>>
>>>The key field is not linked to any other table in any way (other fields are, but they are used
>>>purely as decodes in reports).
>>
>>Oh, I assumed you meant that the key field appeared in other tables: that's why I suggested using
>>referential integrity to make the updates. Yeah, your method above should work.
>
>Thanks for reply. I wrote a quick program and it seems to work.

Great. :-) Did you use the PADL() function to get the leading zeros, or did you add them another way?
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform