remove partitions

  • I have database in which tables are partitioned by month and has 10 years of data. Now I want to delete 5 yrs of data. do i have to delete those partitions, if so how would i ?

  • You have to switch off the partitions you don't want any more with ALTER TABLE {table_name} SWITCH PARTITION {partition number} TO {destination table}. Thereafter you can drop the table if you don't want that data. You can also merge the partitions with ALTER PARTITION FUNCTION {name} MERGE RANGE({value}).

    Look up ALTER TABLE and ALTER PARTITION in BOL.

    -- Gianluca Sartori

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply