日期:2014-05-16 浏览次数:20570 次
SQL SERVER的分区表,如果想知道哪条记录位于哪个分区,然后该分区对应的是哪个文件组,可以这样查找:
??? select fg.name
??? from?sys.destination_data_spaces?sp
??? inner join?sys.partition_schemes?scm on sp.partition_scheme_id = scm.data_space_id
??? inner join?sys.filegroups?fg on fg.data_space_id = sp.data_space_id
??? where scm.name='分区方案名称' and sp.destination_id=分区号;
获得分区号可以:
$PARTITION.分区函数名称(边界值)
?
以上来自http://blog.csdn.net/leftfist/archive/2010/08/04/5788814.aspx
?
?
?
样例
select fg.name
?? ?from sys.destination_data_spaces sp
?? ?inner join sys.partition_schemes scm on sp.partition_scheme_id = scm.data_space_id
?? ?inner join sys.filegroups fg on fg.data_space_id = sp.data_space_id
?? ?where scm.name='ps_recDate' and sp.destination_id=$PARTITION.pf_recDate('2011-01-12T23:59:59.997');
?