Reputation: 2425
I worked with ESRI shapefile format right now and i have some problem with changing/editing database field size. I created a field with 200 length/size and now i want it to only 80 length/size (space & other improvement).
However i can't edit field size anymore :( can somebody point out how to change the field size?
Btw i have tried utilities such as DBF Explorer which can edit field size, but when i change field size on char/text field, data on float/numeric field get deleted :(
DBF Explorer
PS: ESRI database use .dbf extension, which i think it was DBASE III plus or DBASE IV format
Upvotes: 4
Views: 7113
Reputation: 7007
DBF Viewer 2000
had that functionality, even better, it could calculate max length of fields and than resize them.
It is not free, but there is 30 day trial I used when I needed this.
Upvotes: 0
Reputation: 21
To edit the field size in a .dbf file I use OpenOffice. In OpenOfficeSpreadsheet the .dbf feild name would be presented as "FEILDNAME,C,200". To change the size from 200 -> 80 you would have to schange the field name to: "FEILDNAME,C,80" and then save the .dbf file.
Upvotes: 2
Reputation: 1748
Do NOT edit the header, the data is aligned by fixed offset, and changing the size of the field to something that doesn't match the physical length of the record WILL corrupt your table.
You'll need something that can read/write DBFs to effectively do this. An old install of DBase will work, although you would be better off with Visual FoxPro (the FoxPro command would be MODI STRU which is short for "MODIFY STRUCTURE"). I would also look at other tools to push/pull the data into other formats. If you have access to Access (pardon the pun), you could always import the data in to Access as an Access table, restructure the table, then export it out, although starting with Access 2007, native DBF/FoxPro support has been more or less removed, requiring ODBC. Other (more time consuming) measures would be to:
Upvotes: 6
Reputation: 2982
You can edit the header of the file to change it with any hexadecimal editor.
byte 10-11: represents the lenth of a record (least significant byte first)
starting at byte 48 a repeated structure (48 bytes each) describing the field. The byte 33 of this structure represent the length.
Upvotes: 1
Reputation: 53366
Its DBASE III (sort of).
The dbf file both contain the meta data (like field size and type) and the data. They are all stored fixed size.
I can't remember if there are tools to change the fieldsize, but you can create a new table and copy the data. But the format is not that hard.
Upvotes: 1