Query the structure of all database tables, this section of code directly in the new query execution, cold dragon from Elf

Source: Internet
Author: User

SELECT Table name = case If A.colorder=1 then d.name else ' end, table description = case when a.colorder=1 then IsNull ( F.value, ') Else ' end,--field ordinal = a.colorder, field name = A.name, identity = case when ColumnProperty ( A.id,a.name, ' isidentity ') =1 then ' √ ' else ' end, primary key = case if exists (SELECT 1 from sysobjects where xtype= ' P K ' and Parent_obj=a.id and name in (the select name from the sysindexes WHERE indid in (select Indid from       Sysindexkeys WHERE id = a.id and colid=a.colid)) Then ' √ ' Else ' end, type = b.name, number of bytes occupied = a.length,       Length = ColumnProperty (a.id,a.name, ' PRECISION '), number of decimal digits = IsNull (ColumnProperty (a.id,a.name, ' scale '), 0), Allow NULL = case time a.isnullable=1 Then ' √ ' Else ' end, default = IsNull (E.text, '), Field description = IsNull (g.[val UE], ') from syscolumns a LEFT join systypes B on a.xusertype=b.xusertype inner join Sysobject S D on A.id=d.id and D.xtype= ' U ' and d.name<> ' dtproperties ' left joins syscomments E on a.cdefault=e.id left join S      Ys.extended_properties g on a.id=g.major_id and a.colid=g.minor_id left joins Sys.extended_properties F on D.ID=F.MAJOR_ID and F.minor_id=0--where d.name= ' c_party_spreader '--if only the specified table is queried, add this condition to order by A.id,a.colo   Rder

Queries the structure of all database tables, which is executed directly inside the new query, and the cold dragon turns from Elf

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.