导入时 MS Access 自动编号
只是好奇,当我将 519 行电子表格中的数据导入到空表中时,为什么我的自动编号键从 56,557,618 开始? 这能达到多大? 我不想最终用完我的主关键字段的数字,因为我什至没有开始该项目,并且我希望定期转储电子表格。
Just curious, when I imported data from a spreadsheet with 519 lines into an empty table, why did my autonumber keys start at 56,557,618? How big can this get? I don't want to end up running out of digits for my primary key field as I didn't even start on the project and I expect to be dumping spreadsheets in quite regularly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用以下命令重置自动编号而不进行压缩和修复:
您必须在运行 SQL 之前确保表为空,否则 Access 将尝试创建重复的自动编号。
You can reset the autonumber without compact and repair using :
You must make sure the table is empty before running the SQL or you will get Access trying to create duplicate autonumbers.
即使在空表上,Access 也会记住它给出的最后一个 ID。 要重置自动编号,您必须在清空表后压缩/修复数据库
此外,自动编号是一个长整数,在 Access 中最多可达 2,147,483,647
Access remembers the last ID it gave out even on an empty table. To reset the autonumber you have to compact/repair the database after emptying the table
Also the autonumber is a long integer which in Access can go up to 2,147,483,647
您还可以通过创建包含自动编号列的追加查询来重置自动编号。 追加一行后,数字将设置为追加的值 + 1。
执行此操作时,您必须小心该值不小于当前的最高值。
例如
将自动编号重置为最后一个数字的 + 2。 请注意,您必须包含所有必填列,然后删除新行。
You can also reset the autonumber by creating an append query that includes the autonumber column. Once a row is appended then the number will be set to the appended value + 1.
Doing this you have to be careful that the value is not less than the highest current value.
For e.g.
Would reset the autonumber to + 2 of the last number. Note you would have to include any mandatory columns and delete the new row afterwards.