Dear all:
I had put "partition_show" before . but this time it makes faster.

partition_show:

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

create view [dbo].[partition_show]
as
WITH tobjectid AS
(
select t.object_id from sys.tables as t inner join sys.indexes
as i on t.object_id=i.object_id and i.type in (0,1) inner join sys.partition_schemes ps
on i.data_space_id=ps.data_space_id
)
SELECT distinct OBJECT_NAME(T2.object_id) TABLE_NAME
,T1.partition_number
,T4.name as "function_name"
,T3.name as "schema_name"
,T7.name File_group_name
,T1.rows
,CASE boundary_value_on_right
WHEN 1 THEN 'less than'
ELSE 'less than or equal to ' END as 'comparision'
--,CONVERT(varchar(100), T5.value, 112) value
,T5.value value
FROM sys.partitions T1
INNER JOIN sys.indexes T2
ON T1.object_id = T2.object_id
INNER JOIN sys.partition_schemes T3
ON T2.data_space_id = T3.data_space_id
INNER JOIN sys.partition_functions T4
ON T3.function_id = T4.function_id
LEFT JOIN sys.partition_range_values T5
ON T4.function_id = T5.function_id
AND T1.partition_number = T5.boundary_id
INNER JOIN sys.destination_data_spaces T6
ON T6.partition_scheme_id = T3.data_space_id
AND T6.destination_id = T1.partition_number
INNER JOIN sys.filegroups T7
ON T6.data_space_id = T7.data_space_id
/*where T2.object_id in (select OBJECT_ID(t.name) from sys.tables as t inner join sys.indexes as i on t.object_id=i.object_id and i.type in (0,1) inner join sys.partition_schemes ps on i.data_space_id=ps.data_space_id) */
where T2.object_id in (select object_id from tobjectid)
AND T1.index_id<=1
GO

最新文章

  1. 自己动手写ORM框架
  2. Excel命名区域的创建、修改、删除、命名
  3. count distinct 多个字段 或者 count(*) 统计group by 结果
  4. 微软发布ASP.NET 5路线图
  5. java笔记--关于线程通信
  6. IOS 中的CoreImage框架
  7. MST_prim
  8. Android_listView_Listener
  9. OC_NSString
  10. Caffe Python特征抽取
  11. Android 原生listview item伸展收缩效果
  12. Castle扩展Ibatis.Net
  13. XWindow启动流程
  14. 实验:利用ASMLib创建ASM磁盘
  15. [CVPR 2017] Semantic Autoencoder for Zero-Shot Learning论文笔记
  16. Aras前端的一些知识
  17. C# - LINQ 表达式树
  18. redis的安装与简单使用
  19. wx小程序-音频视频!
  20. jQusery .基础

热门文章

  1. Mysql与PostgreSql数据库学习笔记
  2. idea左侧出现日期和文件大小怎么关闭
  3. 一周搞定模拟电路_P5_基本放电电路记录
  4. vue 中监听页面滚动
  5. springboot笔记-1.自动化配置的关键
  6. dp(装箱)
  7. LFTP命令笔记
  8. ASP.NET Core搭建多层网站架构【8.1-使用ViewModel注解验证】
  9. mybatis Plus 多表联合查询
  10. Vue——解决移动端键盘弹起导致的页面fixed定位元素布局错乱