sql 2005 跟據檢視名列出檢視所有列的描述

iSQlServer發表於2010-04-02
select vcu.view_name,tbd.* from (
select tmp.tablename,tmp.columnname,ep.* from sys.extended_properties ep join
(select tb.name as tablename, cl.object_id,cl.name as columnname,cl.column_id from sys.columns cl join
(select name,object_id from sys.tables )tb
 on cl.object_id=tb.object_id) tmp
on ep.major_id=tmp.object_id and   ep.minor_id = tmp.column_id ) tbd join
(select * From INFORMATION_SCHEMA.VIEW_COLUMN_USAGE ) vcu
on tbd.tablename=vcu.table_name and tbd.columnname=vcu.column_name
 where view_name ='檢視名'

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16436858/viewspace-631197/,如需轉載,請註明出處,否則將追究法律責任。

相關文章