相当于 Access 中的 SET IDENTITY_INSERT OFF
正如标题所示,是否有任何方法可以关闭 Access 中的自动编号字段,以允许我插入具有我选择的 id 的行,就像在 SQL Server 中使用 SET IDENTITY_INSERT OFF 所做的那样?
As the title suggests, is there any way of turning off an autonumber field in Access to allow me to insert a row with an id of my choosing, such as you would do with SET IDENTITY_INSERT OFF in SQL Server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 SQL 插入 ID。
You can insert an ID with SQL.
自动编号属性将字段的默认值设置为自动编号种子值。如果自动编号字段也是主键(或具有单独的唯一约束),则您无法重复使用任何存储的值。但是,您可以显式插入任何不与现有存储值冲突的长整数值。如果自动编号字段没有唯一约束,您可以重复插入相同的值。
您可能实际上并不需要相当于 SET IDENTITY_INSERT OFF 的功能
The autonumber property sets a field's default value as the autonumber seed value. If the autonumber field is also the primary key (or has a separate unique constraint), you can't re-use any of the stored values. However, you can explicitly insert any long integer value which doesn't conflict with the existing stored values. And without a unique constraint on the autonumber field you can insert the same value repeatedly.
You may not really even need the equivalent of SET IDENTITY_INSERT OFF