Select
( Case When A. colorder = 1 Then D. Name Else '' End ) N ' Table Name ' ,
A. colorder n ' FIELD No. ' ,
A. Name n ' Field name ' ,
( Case When Columnproperty (A. ID, A. Name, ' Isidentity ' ) = 1 Then ' √ ' Else '' End ) N ' Identifier ' ,
( Case When ( Select Count ( * )
From Sysobjects
Where (Name In
( Select Name
From Sysindexes
Where (ID = A. ID) And (Indid In
( Select Indid
From Sysindexkeys
Where (ID = A. ID) And (Colid In
( Select Colid
From Syscolumns
Where (ID = A. ID) And (Name = A. Name ))))))) And
(Xtype = ' PK ' )) > 0 Then ' √ ' Else '' End ) N ' Primary Key ' ,
B. Name n ' Type ' ,
A. length N ' Bytes occupied ' ,
Columnproperty (A. ID, A. Name, ' Precision ' ) As N ' Length ' ,
Isnull ( Columnproperty (A. ID, A. Name, ' Scale ' ), 0 ) As N ' Decimal places ' ,
( Case When A. isnullable = 1 Then ' √ ' Else '' End ) N ' Null allowed ' ,
Isnull (E. Text , '' ) N ' Default Value ' ,
Isnull (G. [ Value ] , '' ) As N ' Field description '
-- Into # TX
From Syscolumns Left Join Policypes B
On A. xtype = B. xusertype
Inner Join Sysobjects d
On A. ID = D. id And D. xtype = ' U ' And D. Name <> ' Dtproperties '
Left Join Syscomments E
On A. cdefault = E. ID
Left Join Sysproperties g
On A. ID = G. ID And A. colid = G. smallid
Order By Object_name (A. ID), A. colorder
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.