SQL Server 中获取所有的用户表、用户视图的信息


直接贴代码了:

用户表:

 

SELECT s.Name,Convert(varchar(max),tbp.value) as Description
                            FROM sysobjects s
                             LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 AND (tbp.Name='MS_Description' OR tbp.Name is null)  WHERE s.xtype IN('U')

 

 

示例:

 

用户视图:

SELECT s.Name,Convert(varchar(max),tbp.value) as Description
                            FROM sysobjects s
                             LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0  AND (tbp.Name='MS_Description' OR tbp.Name is null) WHERE s.xtype IN('V') 

 

 

谢谢浏览!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM