Q
Problem solve Get help with specific problems with your technologies, process and projects.

How to insert into SQL Server system tables

Get the stored procedure to enable SQL Server updates to the systems' catalog in SQL Server 2005.

Is there a way to insert into SQL Server's system tables. Specifically, I want to mass insert the "description" for certain columns. For example, create_date, will have the same description for all of the tables in the database.

I tried to do the following:

insert into sys.extended_properties(class, class_desc, major_id, minor_id, name, value)
values(1, 'OBJECT_OR_COLUMN', 1973582069,3, 'MS_Description', 'Code used by the
State for reporting purposes');

For which I got the following error:

Msg 259, Level 16, State 1, Line 1
Ad hoc updates to system catalogs are not allowed.

In SQL Server 2005, you cannot enable updates to the systems catalog because they are no longer tables. In order to accomplish what you are doing, you will need to use the sp_addextendedproperty procedure.
This was last published in October 2007

Dig Deeper on SQL Server Stored Procedures

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close