View previous topic :: View next topic
|
Author |
Message |
jayanta_nit
New User
Joined: 13 Apr 2006 Posts: 22 Location: hyderabad
|
|
|
|
Hi,
How do I change the length of a primary key in a table?
Thanks
Jayanta
Hyderabad |
|
Back to top |
|
|
ragganga
New User
Joined: 22 Jan 2007 Posts: 18 Location: bangalore
|
|
|
|
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 |
|
|
divya_maddi
New User
Joined: 03 Nov 2005 Posts: 33
|
|
|
|
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 |
|
|
|