天天看點

【問】做全部資料下載下傳時提示“違反了 PRIMARY KEY 限制 ‘PK_T_BD_ITEM_INFO‘。不能在對象 ‘t_bd_item_info‘ 中插入重複鍵。

【問題描述】

做全部資料下載下傳時提示“違反了 PRIMARY KEY 限制 'PK_T_BD_ITEM_INFO'。不能在對象 't_bd_item_info' 中插入重複鍵。

【答】

修複門店的自增列即可。

use isszmv8_branch 

go

declare @tablename varchar(100)

declare  test_cur cursor for

select object_name(id) from syscolumns

where status=128

open test_cur

fetch test_cur into @tablename

while @@fetch_status=0

begin  

   DBCC CHECKIDENT (@tablename, RESEED)  

   fetch test_cur into @tablename

end

close test_cur

deallocate test_cur

go

繼續閱讀