How to retrive the Table Description

  • Hi All,

                Is there any query in TSQL which returns the table struction, as we can do in oracle e.g,

                    Desc EMP

    Regards,

    Zaheer

  • closest is:

    exec

    sp_help N'EMP'

    or select from a system view/table (depends on SQL version) with N'EMP' or object_id(N'EMP') in the where clause.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • try this

     

    select sysobjects.name as TableName ,syscolumns.name as ColumnName ,systypes.name as TypeData from

    sysobjects inner join

    syscolumns  on sysobjects.id = syscolumns.id        inner join

    systypes    on syscolumns.xtype = systypes.xtype

    where sysobjects.name = 'your table'

  • Thanks Guys

    Regards,

    Zaheer

  • SELECT

    * FROM Information_Schema.columns WHERE table_name = 'tbl_states'

    replace tbl_states with the table name.

     

    Pedro R. Lopez
    http://madurosfritos.blogspot.com/[/url]

  • Hi,

        Once again thanks all of you Gurus

    Regards,

    Zaheer

Viewing 6 posts - 1 through 5 (of 5 total)

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