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
- tomtagaris
- Posts: 85
- Joined: Tue Aug 23, 2016 2:43 pm
- Anand
- Posts: 543
- Joined: Tue May 24, 2016 4:36 pm
- DBs Used: DBF
- Has thanked: 238 times
- Been thanked: 85 times
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
-
- Posts: 238
- Joined: Thu May 25, 2017 6:30 pm
- DBs Used: DBF
- Location: D 83071 Stephanskirchen
- Has thanked: 82 times
- Been thanked: 30 times
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: 829
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
- Has thanked: 30 times
- Been thanked: 234 times
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 98 times