本文介绍了系统目录的临时更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 查询是: EXEC sp_configure允许更新, 1 GO reconfigure 覆盖 GO BEGIN IF EXISTS ( SELECT * FROM SysColumns WHERE SysColumns.id = Object_ID ' acM_OpeningLedger') AND colstat = 1 ) 更新 SysColumns SET colstat = 0 WHERE SysColumns.id = Object_ID(' acM_OpeningLedger') AND colstat = 1 ELSE 更新 SysColumns SET colstat = 1 WHERE SysColumns.id = Object_ID(' acM_OpeningLedger') AND SysColumns.name = ' RowID' END GO EXEC sp_configure允许更新, 0 GO reconfigu重新 覆盖 GO 我在sql server 2005中执行上面的查询,但是他们生成了错误。 错误是:Ad hoc不允许更新系统目录。 如何解决上述问题???? 请帮助我任何人... .. 解决方案 您正在尝试在系统表(SysColumns)上执行更新。你不被允许这样做。执行某些SQL Server管理命令或发生某些情况时,SQL Server会更改系统表。出于安全性和数据完整性原因,SQL Server 2005及更高版本不允许用户进行直接(即Ad-Hoc)更新。 参见在列上添加或删除标识属性 [ ^ ] query is:EXEC sp_configure allow update, 1GOreconfigure with overrideGO BEGIN IF EXISTS (SELECT * FROM SysColumns WHERE SysColumns.id = Object_ID'acM_OpeningLedger') AND colstat = 1) UPDATE SysColumns SET colstat = 0 WHERE SysColumns.id = Object_ID('acM_OpeningLedger') AND colstat = 1 ELSE UPDATE SysColumns SET colstat = 1 WHERE SysColumns.id = Object_ID('acM_OpeningLedger') AND SysColumns.name = 'RowID' ENDGOEXEC sp_configure allow update, 0GOreconfigure with overrideGOI run this above query in sql server 2005, but their have error generate.Error is : Ad hoc updates to system catalogs are not allowed.How can i solved this above problem????Please help me anybody..... 解决方案 You are trying to do an Update on a system table (SysColumns). You are not allowed to do that. System tables are changed by SQL Server when certain SQL Server administration commands are executed or certain conditions occur. Direct (i.e. Ad-Hoc) updates by a user are not allowed for security and data integrity reasons by SQL Server versions 2005 and above.See Add or Remove Identity Property on Column[^] 这篇关于系统目录的临时更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-06 13:46