How to check column comments in sql server

  • Hi,

    Please tell me how can I check column comments or description of column in SQL Server.

    Regards

    Vibhu

  • vibhu22oct (9/17/2012)


    Hi,

    Please tell me how can I check column comments or description of column in SQL Server.

    Regards

    Vibhu

    A little vague as I am not quite sure what you are asking here.

  • Right click the table or column and select properties. Look in the extended properties.

    If the database has a diagram, check the description field in the properties of the table or column.

  • You can also query that data from the "ms_description" extended property.

    See fn_listextendedproperty

    -- Gianluca Sartori

  • Thanks! Didn't know about that function.

  • kl25 (9/17/2012)


    Thanks! Didn't know about that function.

    Another option is querying sys.extended_properties directly.

    -- Gianluca Sartori

  • Thanks again. Should have figured there was a catalog view but didn't know about it either. Based on the view suggested, the OP may find the following helpful:

    Select

    schema_name(so.schema_id) as 'schema',

    so.name as 'table',

    Coalesce(sc.name, '--') as 'column',

    sep.value as 'description'

    From

    sys.extended_properties sep

    Inner join

    sys.objects so

    On

    sep.major_id = so.object_id

    Left outer join

    sys.columns sc

    On

    so.object_id = sc.object_id and

    sep.minor_id = sc.column_id

    Where

    sep.name = 'MS_Description' and

    so.type = 'U';

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

Viewing 9 posts - 1 through 8 (of 8 total)

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