当前位置:Gxlcms > mssql > SQLServer根据分区表名查找所在的文件及文件组实现脚本

SQLServer根据分区表名查找所在的文件及文件组实现脚本

时间:2021-07-01 10:21:17 帮助过:130人阅读

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'

您可能感兴趣的文章:

  • SQL server 2005的表分区
  • SQLSERVER 表分区操作和设计方法
  • SQLServer 通用的分区增加和删除的算法
  • SQL Server实现自动循环归档分区数据脚本详解

人气教程排行