Showing posts with label realized. Show all posts
Showing posts with label realized. Show all posts

Tuesday, February 14, 2012

Change Partition Column

I created a partitioned table and loaded 100 GB of data. After loading the data I realized that it is partitioned on the wrong field. Can I change the partition column without having to reload all of the data?

Recreate the new partition Function and Schemes

and then drop the existing clustered index on the table and move the table to new partition. Sample T-SQL

DROP INDEX IDX_YearWiseSales

ON MyYearWiseSales

WITH (MOVE TO MyMoneyScheme(SaleAmount))

Where MyMoneyScheme is the new Partition scheme.