How to attach a new table in a partitioned table
adding a new partition in a partitioned table structure
Schema:
food
Table:meat
alter table food.meat attach partition part15 starting('2009-01-01') inclusive ending('2009-02-01') exclusive from food.meatJan
Where, meatJan is a table where are the data from January and this table must be the same as food.meat table
Don't forget to apply the SET INTEGRITY command, if you get any errors when you apply it, run it with the exception option, see the example below:
db2 SET INTEGRITY FOR FOOD.MEAT ALLOW WRITE ACCESS IMMEDIATE CHECKED FOR EXCEPTION in FOOD.MEAT USE FOOD.MEAT_EXC
Where, FOOD.MEAT_EXC is table where the data that cannot be inserted in FOOD.MEAT table,so the table FOOD.MEAT_EXP must be the same structure as FOOD.MEAT, so firt you have to create the table FOOD.MEAT_EXP:
db2 create table FOOD.MEAT_EXP like FOOD.MEAT