更改 DBF 字段大小
我现在使用 ESRI shapefile 格式,并且在更改/编辑数据库字段大小时遇到一些问题。 我创建了一个长度/大小为 200 的字段,现在我希望它的长度/大小仅为 80(空间和其他改进)。
但是我无法再编辑字段大小了:(有人能指出如何更改字段大小吗?
顺便说一句,我已经尝试过可以编辑字段大小的 DBF Explorer 等实用程序,但是当我更改字符/文本字段、数据上的字段大小时浮点数/数字字段被删除:(
DBF Explorer
PS:ESRI数据库使用.dbf扩展名,我认为它是DBASE III plus 或 DBASE IV 格式
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
请勿编辑标头,数据按固定偏移量对齐,并将字段的大小更改为与数据的物理长度不匹配的值记录将会损坏你的表。
你需要一些可以读/写DBF的东西来有效地做到这一点。 旧安装的 DBase 也可以工作,尽管使用 Visual FoxPro 会更好(FoxPro 命令是 MODI STRU,它是“MODIFY STRUCTURE”的缩写)。 我还会查看其他工具来将数据推送/拉取为其他格式。 如果您有权访问 Access(请原谅双关语),您始终可以将数据作为 Access 表导入到 Access,重组该表,然后将其导出,尽管从 Access 2007 开始,本机 DBF/FoxPro 支持已经更多或更多少去掉,需要ODBC。 其他(更耗时的)措施是:
数据的行数很少,旧版本总共只能处理 32k 或 64k 行)
在 SO 上搜索此信息)
此处} + {插入廉价管理工具
可以在此处修改表的廉价数据库} + 导出
{廉价数据库}
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:
data has very few rows, older versions can only handle 32k or 64k rows total)
search on SO for this info)
here} + {insert cheapo admin tool for
cheapo database that can modify a table here} + export from
{cheapo database}
为了编辑 .dbf 文件中的字段大小,我使用 OpenOffice。 在 OpenOfficeSpreadsheet 中,.dbf 字段名称将显示为“FEILDNAME,C,200”。 更改大小从 200 -> 80 您必须将字段名称更改为:“FEILDNAME,C,80”,然后保存 .dbf 文件。
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.
您可以使用任何十六进制编辑器编辑文件头来更改它。
字节 10-11:表示从字节 48 开始的记录长度(最低有效字节在前),这
是描述字段的重复结构(每个 48 字节)。 该结构的字节33表示长度。
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.
它的 DBASE III(某种意义上)。
dbf 文件都包含元数据(如字段大小和类型)和数据。 它们都是固定大小存储的。
我不记得是否有工具可以更改字段大小,但您可以创建一个新表并复制数据。 但格式并不难。
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.
DBF Viewer 2000
具有该功能,更好的是,它可以计算字段的最大长度并调整它们的大小。它不是免费的,但当我需要它时,我使用了 30 天的试用版。
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.