Unix Technical Forum

Change column name in replication environment

This is a discussion on Change column name in replication environment within the DB2 forums, part of the Database Server Software category; --> DB2 8.2 on AIX Hi, I'd like to change a column's name in a table which is part of ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 05:40 AM
ibm_97@yahoo.com
 
Posts: n/a
Default Change column name in replication environment

DB2 8.2 on AIX

Hi,

I'd like to change a column's name in a table which is part of
replication.
This column is identity column (generated always).

1. Since DB2 will drop and recreate the table with the changed column
name, do I have to do something like 'set integrity off'?

2. I think I have to exclude the target table from replication, add it
back once the column name is changed. Is this correct?

Thanks a lot!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 05:40 AM
Serge Rielau
 
Posts: n/a
Default Re: Change column name in replication environment

ibm_97@yahoo.com wrote:
> DB2 8.2 on AIX
>
> Hi,
>
> I'd like to change a column's name in a table which is part of
> replication.
> This column is identity column (generated always).
>
> 1. Since DB2 will drop and recreate the table with the changed column
> name, do I have to do something like 'set integrity off'?
>
> 2. I think I have to exclude the target table from replication, add it
> back once the column name is changed. Is this correct?
>
> Thanks a lot!
>

1. Retrieve the identity value with which you want to continue.
2. Create the new table WITHOUT the identity property.
3. LOAD the data
4. ALTER TABLE ALTER COLUMN to make the column an identity column again.

Alternatively you can use the IDENTITY OVERRIDE (sp?) option of LOAD and
alter the table to RESTART with the new value.
I have posted a stored procedure that "synchs up" identity columns after
load repeatedly in this forum.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:47 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com