Database Dictionary Query

Source: Internet
Author: User

1 SELECTTable name=  Case  whenA.colorder= 1  ThenD.name2                   ELSE "'3              END ,4Table description=  Case  whenA.colorder= 1  Then ISNULL(F.value,"')5                    ELSE "'6               END ,7Field ordinal=A.colorder,8Field name=A.name,9Identity=  Case  when ColumnProperty(a.ID, A.name,'isidentity')= 1  Then '√'Ten                   ELSE "' One              END , APrimary key=  Case  when EXISTS(SELECT  1 -                                  fromsysobjects -                                 WHEREXtype= 'PK' the                                          andNameinch ( -                                         SELECTname -                                          fromsysindexes -                                         WHEREIndidinch ( +                                                 SELECTindid -                                                  fromSysindexkeys +                                                 WHEREId=a.id A                                                          andColid=a.colid ))) at                    Then '√' -                   ELSE "' -              END , -Type=B.name, -Number of bytes occupied=A.length, -Length= ColumnProperty(a.ID, A.name,'PRECISION') , inNumber of decimal digits= ISNULL(ColumnProperty(a.ID, A.name,' Scale'),0) , -Allow empty=  Case  whenA.isnullable= 1  Then '√' to                    ELSE "' +               END , -Default value= ISNULL(E.text,"') , theField description= ISNULL(g.[value],"') *  fromsyscolumns a $          Left JOINSystypes b onA.xtype=B.xusertypePanax Notoginseng         INNER JOINsysobjects D ona.ID=d.id -                                     andD.xtype= 'U' the                                     andD.name<> 'dtproperties' +          Left JOINsyscomments E onA.cdefault=e.id A          Left JOINSys.extended_properties g ona.ID=g.major_id the                                                 andA.colid=g.minor_id +          Left JOINSys.extended_properties F onD.id=f.major_id -                                                 andf.minor_id= 0  $  $ --where d.name= ' table to query '--if you only query the specified table, add this condition - ORDER  bya.ID, -A.colorder

Results:

Database Dictionary Query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.