[MSSQL]-(コマンド)すべてのテーブルをリストします.フィールド名主钥匙を選択します.长さ小数点以下の情報

16275 ワード

注意:ネットワークから

  
    
-- ===========================================================
--
SQL SERVER , , , , ,
--

--
===========================================================
select
(
case
when a.colorder = 1 then d.name
else ''
end ) as ' ' ,
a.colorder
as ' ' ,
a.name
as ' ' ,
(
case
when columnproperty (a.id,a.name, ' IsIdentity ' ) = 1 then ' '
else ''
end ) as ' ' ,
(
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 ) as ' ' ,
b.name
as ' ' ,
a.length
as ' ' ,
columnproperty (a.id,a.name, ' PRECISION ' ) as ' ' ,
isnull ( columnproperty (a.id,a.name, ' Scale ' ), 0 ) as ' ' ,
(
case
when a.isnullable = 1 then ' '
else ''
end ) as ' ' ,
isnull (e. text , '' ) as ' ' ,
isnull (g.value, '' ) as ' '
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 join sysproperties g on a.id = g.id and a.colid = g.smallid
order by a.id,a.colorder