SQL Server 2005 身份规范不尊重种子值
我正在将 Access 数据库转换为 SQL Server 2005。我已经使用 SSMA 成功迁移了数据和原始架构,现在正在规范化数据库,这需要我添加一些唯一标识符。
我们之前使用自动编号数据类型创建的一些列,这很好。但是,我需要为其他数据创建无意义但唯一的标识符,因此我将 int 数据类型与身份规范属性一起使用。我在“101”处播种,以使这些数据高于当前已具有唯一标识符的数据存在的范围,因为它们最终将驻留在同一个表中。
我的问题是,当我使用身份规范创建一个种子值为“101”且增量为“1”的新 int 时,数字从“1”开始。我尝试重新播种:
USE dbMyDatabase
DBCC checkident(tblMyTable, reseed, 101)
但无济于事。任何建议将不胜感激。提前致谢!
I am in the process of converting an Access database to SQL Server 2005. I have successfully migrated the data and original schema using SSMA and am now in the process of normalizing the database, which requires me to add a few unique identifiers.
Some of the columns we had were previously created using an AutoNumber data type, which is fine. However, I need to create meaningless but unique identifiers for other data, so I am using the int data type with the Identity Specification property. I am seeding at '101' to keep this data above the range that currently exists for data that already has unique identifiers, as they will eventually reside in the same table.
My problem is that when I create a new int with Identity Specification with a seed value of '101' and an increment of '1', the numbers start at '1'. I have attempted to reseed with:
USE dbMyDatabase
DBCC checkident(tblMyTable, reseed, 101)
to no avail. Any suggestions would be greatly appreciated. Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是通过手动使用 SQL 查询来创建列。通过“新列...”选项添加它每次都会产生不正确的结果。现在我添加了它,
它工作得很好。
The solution was to create the column by using a SQL query manually. Adding it through the "New Column..." option produced incorrect results every time. Now that I added it with
it works just fine.