在我的 SQL 数据库中,我运行了以下脚本来清理数据并重置标识列,
-- disable referential integrity
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
GO
EXEC sp_MSForEachTable 'DELETE FROM ?'
GO
-- enable referential integrity again
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
GO
EXEC sp_MSforeachtable @command1 = 'DBCC CHECKIDENT(''?'', RESEED, 1)'
Go
我收到以下消息,
Checking identity information: current identity value 'NULL'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Checking identity information: current identity value '1'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Checking identity information: current identity value '1'.....
正在为我猜的所有表格打印消息。身份已被重置,数据已被删除。我需要担心这条消息吗?
最佳答案
没有。
创建表 t1(col1 int identity(1,1),col2 int)
插入 t1 选择 1
插入 t1 选择 2
插入到 t1 选择 3
从 t1 中删除
DBCC CHECKIDENT(t1, RESEED, 1)
正在检查身份信息:当前身份值“3”,当前列值“1”。
DBCC 执行完成。如果 DBCC 打印出错误消息,请联系您的系统管理员。
这就像系统预定义的消息一样,只是计数器会有所不同(在我上面的例子中它是'3'(当前身份)和'1'(目标身份号码))
关于sql - DBCC 执行完成。如果 DBCC 打印出错误消息,请联系您的系统管理员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21897871/