Using Extended Properties To Keep Everyone Informed

  • Comments posted to this topic are about the item Using Extended Properties To Keep Everyone Informed

  • Thanks for the article!

    There is a small typo in the following query

    SELECT a.[name] AS 'Logical Name',

    , a.[server_name] AS 'Server Name'

    , b.[name] AS 'Group Name'

    , a.[description]

    FROM [msdb].[dbo].[sysmanagement_shared_registered_servers] a

    JOIN [msdb].[dbo].[sysmanagement_shared_server_groups] b

    ON a.[server_group_id] = b.[server_group_id]

    ORDER BY b.[name] ASC, a.[server_name] ASC

    The comma at the end of SELECT a.[name] AS 'Logical Name', is too much. 🙂

    Question: This is for SQL Server 2008 and newer only?

  • Thanks for catching the typo... when I figure out how to correct it I will!

    As far as what version: CMS is a SQL Server 2008+ feature, although you can use it to "manage" 2000+. Extended properties were actually introduced in 2000 I believe, but this article is aimed at 2005+, no guarantee any of the statements will work with 2000.

  • Well, it's another list to keep track of, but at least it's centralized. It can get out of date, but so can everything else. It's nice that it links stakeholders directly to the think they are a stakeholder of!

  • In lieu of using extended properties, I've done something similar with a table that maps 1-1 to the sysmanagment_shared_registered_servers, creating a central repository for all the server meta-data.

    We're still in the same predicament as you with many undocumented servers and many stakeholders, but it is getting better as a result of CMS. We're also spitting out a dynamic Sharepoint spreadsheet from the data for those more comfortable working from Excel, as well as a weekly spreadsheet to be used as a backup in the event of the CMS server failing.

    I am toying with the idea of extended properties on the individual databases, but frankly we're just not that far along yet.

    Also, I have grouped our servers by edition in CMS, as many of our scripts used in multi-instance queries do not work with SQL 2000, as I'm sure you have discovered.

  • Hello,

    My foray into extended properties at the database-level (SQL2005) was stopped short when I found that only users with elevated rights, such as Control or View Definition, could read them. Has this changed with SQL 2008?

    Mark

    Mark
    Just a cog in the wheel.

  • You know, I really don't know about the permission level for adding/reading the properties. As I mentioned in my post, it is still just an idea I'm toying with. I suppose if security was an issue, it could be addressed by a role allowing users the rights they need for extended properties, and then adding those users or groups to the role.

    We have so many other issues to tackle it just hasn't been high priority and there is also a push to get some sort of third-party tool in here for capturing meta data. I believe many of the third-party tools use extended properties as well, so I've been holding off to see where that goes.

  • Here is a view that I add to my databases that I use to create a column level data dictionary. I think I will incorporate the ideas from this article into it.

    CREATE VIEW [dbo].[DataDictonary] AS

    SELECT schemas.name AS SchemaName

    ,all_objects.name AS TableName

    ,syscolumns.id AS ColumnId

    ,syscolumns.name AS ColumnName

    ,systypes.name AS DataType

    ,syscolumns.length AS CharacterMaximumLength

    ,sysproperties.[value] AS ColumnDescription

    ,syscomments.TEXT AS ColumnDefault

    ,syscolumns.isnullable AS IsNullable

    FROMsyscolumns

    INNER JOIN sys.systypes ON syscolumns.xtype = systypes.xtype

    LEFT JOIN sys.all_objects ON syscolumns.id = all_objects.[object_id]

    LEFT OUTER JOIN sys.extended_properties AS sysproperties ON (sysproperties.minor_id = syscolumns.colid AND sysproperties.major_id = syscolumns.id)

    LEFT OUTER JOIN sys.syscomments ON syscolumns.cdefault = syscomments.id

    LEFT OUTER JOIN sys.schemas ON schemas.[schema_id] = all_objects.[schema_id]

    WHERE syscolumns.id IN (SELECT id

    FROM sysobjects

    WHERE xtype = 'U')

    AND (systypes.name <> 'sysname')

  • I'm uncomfortable with this solution. It seems to be a bit too esoteric/arcane for my tastes. My solution is to have a couple of small tables that handle the information and then a front end on the company intranet to handle data entry, updating status, sending email, etc.

    It seems to me that extended properties are too hidden and too easily lost to make for a good repository for this data. Even if you have documented how and why and where, the next person in your position has to find that documentation and unravel it. If you put this data in a database that is visible from the console it becomes very easy for the next person to find.

    Also, extended properties seem quite limited as you show by having to store a list instead of scalar values. You wouldn't want to do this with data under normal circumstances, so why now?

    --

    JimFive

  • Thanks for the article. This gives a nice option for one to use for self documenting a database.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Great article.

    I've been enforcing extended properties on database objects now for two years and it has made an incredible difference.

    Tables and procedures are now well documented.

    SSRS reports are available to the developers to allow them to see the documentation, and with the aid of ApexSQLDOC I can produce a full data dictionary on request.

    Because we hold databases for multiple companies, all with almost the same structure, additional extended properties help identify who the database belongs to, who is responsible for it and contact details.

    On top of this some were developed to be used to help in code rollout. Whilst the databases are 90% identical code, occasionally a procedure strays due to a fast hotfix. A quick change to a custom "SYNC" property allows us to alert developers that the code is different to other databases, and to DBAs to review the code ASAP to recode it and bring it back into line. This, with the aid of a few custom scripts, has decreased the rollout time of new projects from hours to a matter of minutes.

    It was difficult to persuade other people to use, but now that it is firmly embedded in the culture here it has proved worth its weight in gold. They are definitely an underused and extremely useful recourse.


    ---------------------------------------
    It is by caffeine alone I set my mind in motion.
    It is by the Beans of Java that thoughts acquire speed,
    the hands acquire shaking, the shaking becomes a warning.
    It is by caffeine alone I set my mind in motion.

  • I use extended properties extensively in my own work as a developer.

    I am loath to use them on other developer's work as a dba.

    That's because when a script gets run that drops an oblect, the extended properties I added will be lost.

    I'm not the only dba on the team, so I can't ensure that the extended properties are saved and restored after the item is created. Nor can I ensure that the developers add them to their source code.

    Incidentally, extended properties are not included in the generated create scripts for all objects, i.e., views. That's particularly annoying to me as I like to include column definitions in the views for the data dictionary reports.

  • Eric B-295769 (11/29/2010)


    Comments posted to this topic are about the item <A HREF="/articles/Central+Management+Server/71499/">Using Extended Properties To Keep Everyone Informed</A>

    Hi,

    I am facing the Erron 3709 while i open the Program

  • My web based SQL documentation tool - LiveDoco addresses (to an extent) some of the concerns raised here:

    1) It allows easy access (adding/editing/searching) to any extended properties, including the default MS_Description

    2) It can export them to a SQL file that can be used to merge(add new/update existing) them into a db with similar/same structure. This SQL file could be saved somewhere in case something happens to the DB (and/or all your EPs in it).

    It can do other things as well, but not directly related to this topic so please see www.livedoco.com for more information if interested.

  • I had used the description extended property to keep a list of what all columns in my tables were used for and whether they were really being used anymore. I never thought of using it also to keep track of what stakeholders were interested in the database. Nor did I know that you could setup custom extended properties.

    Thank you for sharing this information. Very much appreciated.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic. Login to reply