Click here to Skip to main content
15,886,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
query is:

SQL
EXEC sp_configure allow update, 1
GO
reconfigure with override
GO
 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'
 END
GO
EXEC sp_configure allow update, 0
GO
reconfigure with override
GO



I 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.....
Posted
Updated 14-Dec-13 2:46am
v2

1 solution

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[^]
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900