【发布时间】:2013-10-31 00:52:39
【问题描述】:
错误: 将 IDENTITY 转换为数据类型 int 的算术溢出错误。 发生算术溢出。
调试:
id = 我的身份列,数据类型 INT。增量=1,种子=1
select max(id) as max, min(id) as min from eventlogreport
Result: 6728550 1
select count(*) from eventlogreport
Result: 6728550
到目前为止还不错。看起来我们有足够的空间容纳更多行。但是再插入 600 000 行会导致溢出错误。更多调试。
SELECT IDENT_CURRENT ('EventLogReport') AS Current_Identity;
Result: 2147483647
问题:
- 表没有的情况下,当前的标识值怎么会这么高 包含相同数量的行,并且没有 id 跳过?
- 如何安全地将 IDENT_CURRENT 设置为与 max(id) 相同的数字?或者,只要不引用 id 列,重新播种可能更容易?
【问题讨论】:
-
为什么不赞成这个问题?
标签: sql-server-2008 transactions identity-column