Problem Description:
Today doing partition switching when the old log data cut to clear the table, encountered this problem, the way to do it under note-taking solution
'ALTER TABLE SWITCH' statement failed. Table 'MGXXX.dbo.user_XXX' Zoned, but the index 'ix_user_XXX_user_id' is not partitioned.
Solution:
The source table and the target table partition or partition file must be in the same group, the corresponding index or index partition file must be in the same group.
I checked the error of the index, it really is a file group is [PRIMARY], the partition table is set with the partition file
Rebuild the index partition scheme, delete the original index, then cut partitions on it
# Partitioning scheme, non-clustered index the CREATE NONCLUSTERED the INDEX [ ix_user_XXX_user_id ] the ON [ the dbo ] . [ USER_XXX ] ( user_id ASC ) the WITH (Online = ON ) the ON [ ps_user_XXX ] ( [ the ctime ] ) the GO