Sunday, March 25, 2012

Can we alter system views in SQL Server 2005?

Hi, all experts here,

Thank you for your kind attention.

Would please anyoneh ere give me any advices about if we can alter system views in SQL Server 2005 ?

With best regards,

modifying system objects is no longer allowed in sql2k5...|||Can you let us know of your scenario which requires you to alter the system views ?|||

Hi, Asvin,

Thank you very much for your kind attention.

The original reason for me to wonder if it is possible to alter system objects was that since in SQL Server 2005 we got a INFORMATION_SCHEMA.COLUMNS view which collects the information about all the columns within the database, but what I think will be helpful is the description for the columns. Since I am currently having a large database with up to serveral hundred tables which got a large number of columns without any explanation for what are those columns about, as a result, it's been very difficult to understand the whole database to have further analysis based on it.

If database designer could put description for each column within the database, and at the same time add a column_descpription column into the INFORMATION_SCHEMA.COLUMNS within the system view, it will be very helpful for other users rather than database designers to understand the data well.

Hope my explanation above clear what my question is and thank you very much in advance for your further advices and guidance.

With best regards,

Yours sincerely,

|||

If that is your intent I would suggest that you add extended properties on the table columns. Take a look at this feature at http://msdn2.microsoft.com/en-us/library/ms190243.aspx.

or look it up in books online.

In short, extended properties let you add a description to any object in the database such as tables, views, schemas, columns etc.

e.g.

To add an extended property to a column of a table you could do something like

sp_addextendedproperty 'property_name','your description','schema','schema_name_of_table','table','table_name','column','column_name'

and then to retrieve it you can use the function fn_listextendedpropety or the catalog view sys.extended_properties.

select * from sys.fn_listextendedproperty('property_name','schema','schema_name_of_table','table','table_name','column','column_name') will return 'your description'.

Hope this helps and is a good starting point to solve your problem.

Please do not attempt to modify or change the system views in sql server. It will leave the database in a corrupt state.

sql

No comments:

Post a Comment