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'

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐