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 sys***ments e
on a.cdefault=e.id
left join sysproperties g
on a.id=g.id and a.colid = g.**allid
order by object_name(a.id),a.colorder
資料庫字典 sql
select 表名 case when a.colorder 1 then d.name else end,表說明 case when a.colorder 1 then isnull f.value,else end,字段序號 a.colorder,欄位名 a.name,標識 case when ...
SQL 匯出資料字典
用於參考 select 表名 case when a.colorder 1 then d.name else end,表說明 case when a.colorder 1 then isnull f.value,else end,字段序號 a.colorder,欄位名 a.name,主鍵 case ...
PHP匯出資料庫資料字典指令碼
author change 配置資料庫 dbserver 192.168.1.218 3306 dbusername admin dbpassword 111 database test 其他配置 title 資料字典 mysql conn mysql connect dbserver,dbuser...