I would like some help on how to add a type to a .dpf file without losing data through a program
tom Tagaris
change .dbf without losing data
Moderator: Rathinagiri
Re: change .dbf without losing data
1. Copy to _temp.dbf
2. Change structure of dbf
3. Append from _temp.dbf
4. Delete _temp.dbf
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Re: change .dbf without losing data
thanks
tom
tom
Re: change .dbf without losing data
This is good when you are adding a new field or deleting a field.
But if you want to change 'type' of a field from say 'number' to 'character' then here you will lose data.
For this scenario I copy to SDF format and then append from this file.
Care should be taken NOT to add/delete field and change type at same time.
Regards,
Anand
Re: change .dbf without losing data
My way to do this is:
First step:
add a new field to the table.
Second step:
eg: replace newfield with str(oldfield) or val(oldfield) depending on the datatype of new field.
You now can keep the oldfield as long as you like in your dbf.
Regards
Robert
First step:
add a new field to the table.
Second step:
eg: replace newfield with str(oldfield) or val(oldfield) depending on the datatype of new field.
You now can keep the oldfield as long as you like in your dbf.
Regards
Robert
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: change .dbf without losing data
This is a problem that has torture me many times, so i wrote a program to help solve it
change1.prg - input of old and new structure
change2.prg - creates a change.prg program that solves the problem
old structure is test.dbf, new test2.dbf
change1.prg - input of old and new structure
change2.prg - creates a change.prg program that solves the problem
old structure is test.dbf, new test2.dbf
- Attachments
-
- change.zip
- (15.91 KiB) Downloaded 189 times