how to see the comments about an object

  • In the SQL Analyzer, I want to see comments about a user tables or columns inside them. HOw?

  • Take a look at sysproperties. Just run a query something like this:

    select name, value from sysproperties where object_name(id)='categories' and name='ms_description'

    Categories is a table name in this case, from Pubs.

    Andy

  • Or as is preferred by Microsoft look at fn_listextendedproperty in BOL. Here is an excert.

    Syntax

    fn_listextendedproperty (

    { default | [ @name = ] 'property_name' | NULL }

    , { default | [ @level0type = ] 'level0_object_type' | NULL }

    , { default | [ @level0name = ] 'level0_object_name' | NULL }

    , { default | [ @level1type = ] 'level1_object_type' | NULL }

    , { default | [ @level1name = ] 'level1_object_name' | NULL }

    , { default | [ @level2type = ] 'level2_object_type' | NULL }

    , { default | [ @level2name = ] 'level2_object_name' | NULL }

    )

    Arguments

    {default|[@name =] 'property_name'|NULL}

    Is the name of the property. property_name is sysname. Valid inputs are default, NULL, or a property name.

    {default|[@level0type =] 'level0_object_type'|NULL}

    Is the user or user-defined type. level0_object_type is varchar(128), with a default of NULL. Valid inputs are USER, TYPE, default, and NULL.

    {default|[@level0name =] 'level0_object_name'|NULL}

    Is the name of the level 0 object type specified. level0_object_name is sysname with a default of NULL. Valid inputs are default, NULL, or an object name.

    {default|[@level1type =] 'level1_object_type'|NULL}

    Is the type of level 1 object. level1_object_type is varchar(128) with a default of NULL. Valid inputs are TABLE, VIEW, PROCEDURE, FUNCTION, DEFAULT, RULE, default, and NULL.

    Note Default maps to NULL and 'default' maps to the object type DEFAULT.

    {default|[@level1name =] 'level1_object_name'|NULL}

    Is the name of the level 1 object type specified. level1_object_name is sysname with a default of NULL. Valid inputs are default, NULL, or an object name.

    {default|[@level2type =] 'level2_object_type'|NULL}

    Is the type of level 2 object. level2_object_type is varchar(128) with a default of NULL. Valid inputs are COLUMN, PARAMETER, INDEX, CONSTRAINT, TRIGGER, DEFAULT, default (which maps to NULL), and NULL.

    {default|[@level2name =] 'level2_object_name'|NULL}

    Is the name of the level 2 object type specified. level2_object_name is sysname with a default of NULL. Valid inputs are default, NULL, or an object name.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 3 posts - 1 through 2 (of 2 total)

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