Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts

    MSSQL: Select Column Descriptions from a Table

    I'm using MS SQL, I'm wondering if anyone knows a way for me to retrieve a column's description in a query. I can get everything else, Identity seed, data type etc. just can't seem to find any info on retrieving the description.

    Thanks,
    Basscyst
    Last edited by guelphdad; 01-05-2007 at 04:40 AM. Reason: add database
    Helping to build a bigger box. - Adam Matthews

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Meta data?

    SELECT *
    FROM INFORMATION_SCHEMA.Tables T JOIN INFORMATION_SCHEMA.Columns C
    ON T.TABLE_NAME = C.TABLE_NAME
    WHERE T.TABLE_NAME = 'yourTablename'
    ORDER BY C.COLUMN_NAME

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Yeah, all the examples I've found give me that data, but it doesn't include the data I'm interested in. The highlighted field in the image below is what I am looking for.



    Thanks,
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #4
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,092
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Starting with MySQL 5.0, it appears that you can get this information using the Information_Schema database. You can read more about it here.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #5
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    The OP is using MSSQL and not MySQL. I'll move the thread to the general database area.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    That information is stored in the table 'sysproperties' as binary data , joinable with the id of the column in 'sysobjects'
    I am the luckiest man in the world

  • #7
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Perfect! Thanks a million.
    Helping to build a bigger box. - Adam Matthews


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •