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 columnproperty( a.id,a.name,'isidentity')=1 then '√'else '' end,
主鍵=case when exists(select 1 from sysobjects where xtype='pk' and name in (
select name from sysindexes where indid in(
select indid from sysindexkeys where id = a.id and colid=a.colid
))) then '√' else '' end,
型別=b.name,
占用位元組數=a.length,
長度=columnproperty(a.id,a.name,'precision'),
小數字數=isnull(columnproperty(a.id,a.name,'scale'),0),
允許空=case when a.isnullable=1 then '√'else '' end,
預設值=isnull(e.text,''),
字段說明=isnull(g.[value],'')
from syscolumns a
left join systypes b on a.xusertype=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
left join sysproperties f on d.id=f.id and f.smallid=0
--where d.name='table_name' --如果要查詢特定table,加上這句
order by a.id,a.colorder
Bamboo中的字段描述表
bamboo中的模型定義的時候,需要為每個字段設定乙個字段描述表。這個表由乙個個的屬性和屬性值構成。將已經定義的屬性和屬性值羅列如下 table 屬性 取值 說明 newfield true or false or nil 標明此欄位是否是新字段 相對於繼承字段來講 required true or...
sql語句實現增加表 字段描述性文字
建立表及描述資訊 create table 表 a1 varchar 10 a2 char 2 為表新增描述資訊 execute sp addextendedproperty n ms description 人員資訊表 n user n dbo n table n 表 null,null 為字段a...
檢視或新增修改sql表和字段描述
檢視表字段描述 select a.name as table name,b.name as column name,c.value as column description from sys.tables a inner join sys.columns b on b.object id a.ob...