首页 > 代码库 > SQL Server DBA-日常查询视图

SQL Server DBA-日常查询视图

 

1.查询表名或列名中文注释(sqlserver 2008)

技术分享
select t.object_id,t.name, p.value from sys.tables tjoin sys.extended_properties p on t.object_id = p.major_id and p.name = MS_Descriptionand p.minor_id=0;
1.1查询表名中文注释

 

技术分享
select t1.*,t2.name as column_namefrom (select t.object_id,p.major_id,p.minor_id,t.name as tables_name, p.value,t.type,t.type_desc from sys.tables tjoin sys.extended_properties p on t.object_id = p.major_id and p.name = MS_Description) t1 left join syscolumns t2 on t1.object_id=t2.id and t1.minor_id=t2.colid;
1.2查询出表名及列名中文

 

SQL Server DBA-日常查询视图