相当于 Access 中的 SET IDENTITY_INSERT OFF

发布于 2024-12-08 17:48:58 字数 110 浏览 7 评论 0原文

正如标题所示,是否有任何方法可以关闭 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬花如无物 2024-12-15 17:48:58

您可以使用 SQL 插入 ID。

INSERT INTO Table1 (ID) Values (-10)

You can insert an ID with SQL.

INSERT INTO Table1 (ID) Values (-10)
千秋岁 2024-12-15 17:48:58

自动编号属性将字段的默认值设置为自动编号种子值。如果自动编号字段也是主键(或具有单独的唯一约束),则您无法重复使用任何存储的值。但是,您可以显式插入任何不与现有存储值冲突的长整数值。如果自动编号字段没有唯一约束,您可以重复插入相同的值。

您可能实际上并不需要相当于 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文