ジョブのスクリプトは次のとおりです。
alter partition function PF_MyFunction() MERGE RANGE (20111231)
alter partition scheme PS_Myfunction next used [FG2011]
alter partition function PF_MyFunction() SPLIT RANGE (20111231)
これは、パーティションが実際に別の FG にあることを確認するスクリプトです。前後に実行します。
SELECT
schema_name(c.schema_id) [Schema_Name]
,object_name(a.object_id) [Table_Name]
,a.name [Index_Name]
,a.type_desc [Index_Type]
,d.Partition_Number [Partition_Number]
,b.name [Logical_DataSpace Name or PS name]
,b.data_space_id [Logical_DataSpaceID_PS_ID]
,f.name [Partition Function]
,f.function_id [Partition Function ID]
,g.value [Partition Boundary Value]
,ISNULL (h.data_space_id, b.data_space_id)
[Physiscal DataSpace ID]
,i.name [FileGroup Name]
,i.type_desc [Physical Dataspace desc]
FROM (sys.indexes a inner join sys.tables c
on a.object_id = c.object_id)
INNER JOIN sys.data_spaces b on a.data_space_id = b.data_space_id
INNER JOIN sys.partitions d on d.object_id = a.object_id
LEFT JOIN sys.partition_schemes e on e.data_space_id = b.data_space_id
LEFT JOIN sys.partition_functions f on f.function_id = e.function_id
LEFT JOIN sys.partition_range_values g on g.function_id = f.function_id and g.boundary_id = d.partition_number
LEFT JOIN sys.destination_data_spaces h
on h.partition_scheme_id = e.data_space_id AND h.destination_id = d.partition_number
INNER JOIN sys.data_spaces i on i.data_space_id = isnull (h.data_space_id, b.data_space_id)
WHERE c.name = 'MyTable'