Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change string length, as in character length?

Status
Not open for further replies.

litesleeper

Technical User
Sep 20, 2003
3
0
0
AE
im a trainee in a firm , which uses foxpro 2.5 based on DOS. I need to change the length of a character string from 4 to 5.
I tried going to view and then set-up, but was unable to change it there.if possible pls give a step by step format.
thx in advance
 
In order to change the structure of a table you must be the only one using it.

USE yourtable EXCLUSIVE
MODIFY STRUCTURE
 
Further to mlv1055 response
field to be truncated is 'myfield'

USE yourtable EXCLUSIVE
REPLACE ALL myfield with ALLTRIM(myfield)
MODIFY STRU

This extra line will give better data transfer when you shorten the field, where for example a leading space was included.
 
Hey!

Changing the length is easy. But you should consider if the field is critical. Critical being it is a key, it sis involved in a coumpond keys like INDEX ON code + yourfield + other field. If this is so, the program using it may fail.

Note also that if the program writing to that field writes only 4 characters, there is no pint changing it to accomodate more characters. The program has to be change also.

Lastly, do you have a backup?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top