45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:SQL Server如何实现根据分区表名查找所在的文件和文件组?

SQL Server如何实现根据分区表名查找所在的文件和文件组?

2015-07-25 07:49:18 来源:www.45fan.com 【

SQL Server如何实现根据分区表名查找所在的文件和文件组?

SELECT ps.name AS PSName, 
 dds.destination_idAS PartitionNumber, 
 fg.name AS FileGroupName,fg.name,
 t.name,
 f.name as filename
 FROM (((sys.tables AS t 
 INNER JOIN sys.indexes AS i
   ON (t.object_id = i.object_id)) 
 INNER JOIN sys.partition_schemes AS ps 
   ON (i.data_space_id = ps.data_space_id)) 
  INNER JOIN sys.destination_data_spacesAS dds 
   ON (ps.data_space_id = dds.partition_scheme_id))
  INNER JOIN sys.filegroups AS fg 
    ONdds.data_space_id =fg.data_space_id
    innerjoin sys.database_files f on f.data_space_id = fg.data_space_id
   where t.name='salesOrder'

本文地址:http://www.45fan.com/a/question/15619.html
Tags: sql Server 根据
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部