怎么取得视图中列的描述信息?已经取得表的字段描述信息了
rt
在Sql server 2005中
查找表的字段sql语句如下:
--取得表名和表id
select tb.name as tableName,tb.object_id from sys.tables tb where name <> 'sysdiagrams ' order by tableName
select col.name,pro.value as description from sys.columns col
left outer join
sys.extended_properties pro
on col.object_id=pro.major_id and pro.minor_id=col.column_id
where col.object_id= '1170103209 ' 《--查到的表的id
可是在视图查询中无效
--取得视图的名字和id
select * from sys.objects
select name as ViewName ,object_id as ViewID from sys.views
可是按照查表列方法,取不到描述信息
实际上,在表sys.extended_properties中都没有视图id信息,怎么回事啊,找的我头都大了
:(
各位,救命啊
------解决方案--------------------2005没用过,不知道
帮顶
------解决方案--------------------得在视图上再加扩展属性,再显示出来
EXEC sys.sp_addextendedproperty
@name = N 'MS_DescriptionExample ',
@value = N 'Minimum inventory quantity. ',
@level0type = N 'SCHEMA ', @level0name = dbo,
@level1type = N 'view ', @level1name = view_tst,
@level2type = N 'COLUMN ', @level2name = name
select * from ::fn_listextendedproperty (NULL, 'SCHEMA ', 'dbo ', 'view ', 'view_tst ', 'column ', default)--
------解决方案--------------------ding
------解决方案--------------------1.select object_name(depid) from sys.sysdepends where object_name(id)= 'viewtest '
找出视图依赖的表
2.select * from ::fn_listextendedproperty (NULL, 'SCHEMA ', 'dbo ', 'table ', tbname ', 'column ', default)
找出基表的扩展属性
------解决方案--------------------ding
------解决方案--------------------关注