Column description

  • BG0AWI

    SSC Veteran

    Points: 289

    Is there a way in T-sql get the defined COLUMN DESCRIPTION text (One of the Column properties when you're in 'design table'-mode)??




  • Antares686

    SSC Guru

    Points: 125444

    You could look at the syscomments table for the data or use the preferred fn_listextendedproperty which works but takes a bit to use, check out BOL for more information.

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

  • G.R.Prithiviraj Kulasingham

    SSCarpal Tunnel

    Points: 4104

    The SysProperties Table has the description.

    the name should be 'MS_Description'

    Here I have a sample code

    select O.Name [Table_name], [Column_Name],

    p.Value [description]

    From dbo.SysObjects O,

    dbo.SysColumns C Left Outer Join

    (select id, smallid, name, Value from dbo.SysProperties

    Where Name = 'MS_Description') P

    On = and P.smallid = C.Colid

    Where = and ObjectProperty(, 'ISUSERTABLE')=1

    Order By, c.colid

    If you have different users owning tables with same file names You may have to add the table_schema too.


    Prithiviraj Kulasingham

  • Antares686

    SSC Guru

    Points: 125444

    Sorry about that sysporperties is correct. Having a murphy day here. ANyway you should learn to use the function thou as MS states system changes can change between versions but functions should remain the same.

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

Viewing 4 posts - 1 through 4 (of 4 total)

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