Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How do I change the length of a primary key in a table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
jayanta_nit

New User


Joined: 13 Apr 2006
Posts: 22
Location: hyderabad

PostPosted: Tue Apr 10, 2007 12:52 pm    Post subject: How do I change the length of a primary key in a table
Reply with quote

Hi,
How do I change the length of a primary key in a table?

Thanks
Jayanta
Hyderabad
Back to top
View user's profile Send private message

ragganga

New User


Joined: 22 Jan 2007
Posts: 18
Location: bangalore

PostPosted: Tue Apr 10, 2007 1:31 pm    Post subject:
Reply with quote

Hi Jayanth,

As per my knowledge, we can not change lenght of any column in DB2 Table.

Solution is, Create another Table with same features of that Table with increasing primary column length.

If i am wrong, please correct me.

Regards
Raghu.
Back to top
View user's profile Send private message
divya_maddi

New User


Joined: 03 Nov 2005
Posts: 33

PostPosted: Tue Apr 10, 2007 2:58 pm    Post subject:
Reply with quote

the length of varying-length character data type values allowed for a particular column can be increased by executing the ALTER TABLE SQL statement

So if your primary key is defined as varchar, you can change its length with the following syntax:

ALTER COLUMN [ColumnName] SET DATA TYPE [VARCHAR | CHARACTER VARYING | CHAR VARYING] ([Length])

Example:

ALTER COLUMN DEPTNAME SET DATA TYPE VARCHAR(100)

The above statement will set the maximum length of deptname column to 100 bytes.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us