Generate SQL of the Dictionary Dictionary

zhaozj2021-02-16  61

SELECT Name = Case When a.colorder = 1 Then D.Name Else '' end, field number = a.colorder, field name = a.name, identity = case when columnproperty (A.ID, A.Name, 'isidentity ') = 1 then' √'else '' end, the primary key = case when exists (SELECT 1 FROM sysobjects where xtype = 'PK' and name in (SELECT name FROM sysindexes WHERE indid in (SELECT indid FROM sysindexkeys WHERE id = a. ID and color = a.colid)))) "√ 'else' 'end, type = B.Name, occupying bytes = a.length, length = columnproperty (A.ID, a.name,' precision ') , Decimal number = ISNULL (A.ID, A.NAME, 'Scale'), 0), Allow empty = case when a.isnullable = 1 Then '√'lse' end, default = ISNULL (E .text, ''), Field Description = ISNULL (g. [value], ') from syscolumns a left join systempes 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 A .id, a.colorder

转载请注明原文地址:https://www.9cbs.com/read-20047.html

New Post(0)