One, only support the table, very good
SELECT A.name, ( CaseWhen (SELECT count (*) from sysobjects WHERE (nameinch(SELECT name from sysindexes WHERE (id =a.id) and (Indidinch(SELECT indid from Sysindexkeys WHERE (id =a.id) and (Colidinch(SELECT colid from syscolumns WHERE (id = a.id) and (name = A.name))))))) and (Xtype ='PK')) >0Then'1' Else '0'end) Isprimary,b.name [Type],columnproperty (A.id,a.name,'PRECISION') as[Length],isnull (G.value,"') as[description] from syscolumns a left join systypes 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 joins Sys.extended_properties G on a.id=g.major_id and a.colid =g.minor_idwhereD.name ='indicate that'ORDER BY A.id,a.colorder
Second, general cool, support table
Select as as as from syscolumns c inner joins systypes T on c.xusertype=where objectproperty (c.id, ' isusertable ') =1 and c.id=object_id (' indicate ')
Three, general cool, support view
Select as as as length from syscolumns c inner joins systypes T on c.xusertype=where objectproperty (c.id,' C10>isview') =1 and c.id=object_id ('v_allsay' )
Ask the big God very well. Supports both table and view-supported SQL
Find field property information in SQL data tables or views