Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Add a partition to a table that already has partitions

0 views
Skip to first unread message

Justin

unread,
Oct 20, 2008, 3:20:51 PM10/20/08
to

Is there a way to attach a partition to an existing table that already
has partitions (without loading data)? For example, the syntax of the
attach partition is documented below:

alter table <tablename> attach partition P_data_2009Q1 STARTING FROM
('01/01/2009') INCLUSIVE ENDING AT ('03/31/2009') INCLUSIVE from
<tableload>

The goal is to set-up the partition but not actually load any data
into it.

Here is my thought:

alter table <tabname> attach partition P_data_2009Q1 STARTING FROM
('01/01/2009') INCLUSIVE ENDING AT ('03/31/2009') INCLUSIVE in
<tablespace>

-OR- Do I load from an empty table?

Serge Rielau

unread,
Oct 20, 2008, 3:25:42 PM10/20/08
to
CREATE TABLE P_data_2009Q1 LIKE <tabname>

Should be all you need. That gives you an empty table.


--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Justin

unread,
Oct 20, 2008, 3:39:56 PM10/20/08
to

So the basic strategy, create an empty table. Attach new partition
with empty table and then we could drop the table.

Thank you.

> IBM Toronto Lab- Hide quoted text -
>
> - Show quoted text -

Serge Rielau

unread,
Oct 20, 2008, 4:14:19 PM10/20/08
to
Justin wrote:
> So the basic strategy, create an empty table. Attach new partition
> with empty table and then we could drop the table.
I think you have a misconception of what attach means.
The attached table gets turned into the partition. There is no need to
drop it. It just goes *poof* (that's a technical term :-)
0 new messages