View previous topic :: View next topic
|
Author |
Message |
harikrishnanrajeev
EXPERT
Joined: 28 Jan 2004 Posts: 37 Location: Trivandrum
|
|
|
|
Hello all,
I have some doubts regarding DB2.
1 . Is there any command to view the structure of a table.
eg desc tablename in oracle.
2. Is it possible to alter the size of a column after the table has been
created.
eg . a field name varchar(20) , i want to alter the size to varchar(25)
3. What is the purpose of using indexing on using a primary key.
Thanks & Regards
Hari. |
|
Back to top |
|
|
mdtendulkar
Active User
Joined: 29 Jul 2003 Posts: 237 Location: USA
|
|
|
|
Hello harikrishnanrajeev,
1) use DCLGEN
2) No, create a new column, fill in the values
3) Record retrieval is fast and efficient.
Hope this helps
Regards
mayuresh Tendulkar |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
in V8.1 its possible to alter the size of the column
ALTER TABLE TABLE-NAME MODIFY COLUMN-NAME TYPE(SIZE);
1.its always possible to increase the size of the column
2.not possible to decrease the size of the column if data existed in that column. even if you want to decrease, update that column with null value
then decrease the size. |
|
Back to top |
|
|
Prajesh_v_p
Active User
Joined: 24 May 2006 Posts: 133 Location: India
|
|
|
|
For the questioon No 1:
I think u can query the catalogue table sysibm.systables and sysibm.syskeys to get the table details and index on the table..
Hope this helps... |
|
Back to top |
|
|
bonniem
New User
Joined: 09 Aug 2005 Posts: 67
|
|
|
|
to add to what prajesh said, you have to actually look at the SYSCOLUMNS table to get the structure of table. Anyways easiest way is DCLGEN. |
|
Back to top |
|
|
|