能不能取到表字段的注释呢? ( 积分: 10 )

  • 主题发起人 主题发起人 yzy88nihaoma
  • 开始时间 开始时间
Y

yzy88nihaoma

Unregistered / Unconfirmed
GUEST, unregistred user!
如题!!
获取该表中的字段注释?能不能做到?有兴趣的讨论一下.
 
分少?没人讨论吗?小弟实在没分了.各位大哥!!
 
晕倒?没人?快点来帮忙啊
 
我也不知道[8D]
 
这个够全了,是先人的代码,好好用吧,给我加分啊[:D]
SELECT
(case when a.colorder=1 then
d.name else
'' end)表名,
a.colorder 字段序号,
a.name 字段名,
(case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then
'√'else
'' end) 标识,
(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) 主键,
b.name 类型,
a.length 占用字节数,
COLUMNPROPERTY(a.id,a.name,'PRECISION') as 长度,
isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0) as 小数位数,
(case when a.isnullable=1 then
'√'else
'' end) 允许空,
isnull(e.text,'') 默认值,
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

-----表MSreplication_options
where d.name = 'MSreplication_options'
order by a.id,a.colorder
 
呵呵,谢谢,给了我很大的启发.
 

Similar threads

后退
顶部