使用Detach、Attach建成的DB有時候受到殘留的發佈訂閱的垃圾侵擾,造成更新腳本無法執行,這種情況在系統上線前的內部測試時經常遇到,下面的幾個語句就是用來處理此類情況發生的。
--涉及到發佈訂閱的字段
select * from syscolumns
where colstat=4096
--涉及到發佈訂閱的表名
select * from sysobjects
where replinfo>0
將上述記錄的檢索值改成0就可以了
--allow update system tables
sp_configure 'allow update','1'
go
--reload SQL using new set value
reconfigure with override
go
--更新完成之後,要把允許修改系統表改回來。
--forbid update system tables
sp_configure 'allow update','0'
go
--reload SQL using new set value
reconfigure with override
go