国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

如何得到數據庫中所有表字段及字段中文描述

2024-07-21 02:23:03
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn

如何得到數據庫中所有表字段及字段中文描述
以下資料,通過csdn的一位師兄從sql版主那得到:
sql中
select
(case when a.colorder=1 then d.name else '' end) n'表名',
a.colorder n'字段序號',
a.name n'字段名',
(case when columnproperty( a.id,a.name,'isidentity')=1 then '√'else '' end) n'標識',
(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'主鍵',
b.name n'類型',
a.length n'占用字節數',
columnproperty(a.id,a.name,'precision') as n'長度',
isnull(columnproperty(a.id,a.name,'scale'),0) as n'小數位數',
(case when a.isnullable=1 then '√'else '' end) n'允許空',
isnull(e.text,'') n'默認值',
isnull(g.[value],'') as n'字段說明'
--into ##tx

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 object_name(a.id),a.colorder

一個字,爽,還可以省去做dd時的好多麻煩.
如果不是很明白,可以將以上代碼放到sql查詢分析器上運行一下就知道了(當然要打開一個數據庫啦)



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄂州市| 磐石市| 贡觉县| 光山县| 五大连池市| 都江堰市| 枝江市| 兴文县| 阿勒泰市| 无为县| 靖江市| 亚东县| 大同县| 大渡口区| 大关县| 东乡族自治县| 醴陵市| 澄江县| 冕宁县| 修文县| 宜良县| 汽车| 潞城市| 靖江市| 樟树市| 平遥县| 晋中市| 屏山县| 普定县| 青阳县| 新乐市| 庆阳市| 吴江市| 德格县| 曲阳县| 盐边县| 无锡市| 兰考县| 兖州市| 古丈县| 阿图什市|