国产探花免费观看_亚洲丰满少妇自慰呻吟_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查詢分析器上運行一下就知道了(當然要打開一個數據庫啦)



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 古田县| 合水县| 泽州县| 万宁市| 五大连池市| 汉阴县| 鹿泉市| 包头市| 房山区| 桂平市| 霞浦县| 海南省| 阿拉善左旗| 黑河市| 东乡族自治县| 杂多县| 深水埗区| 莒南县| 威信县| 中西区| 清新县| 洛扎县| 尼玛县| 岑巩县| 海晏县| 无棣县| 晋江市| 宁波市| 永清县| 谢通门县| 江川县| 金寨县| 姚安县| 朝阳区| 南充市| 讷河市| 公主岭市| 奉化市| 甘孜| 同德县| 浠水县|