IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 , how to view structure of a table , indexing


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
harikrishnanrajeev

EXPERT


Joined: 28 Jan 2004
Posts: 37
Location: Trivandrum

PostPosted: Tue Feb 17, 2004 11:46 pm
Reply with quote

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
View user's profile Send private message
mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 237
Location: USA

PostPosted: Thu Feb 19, 2004 2:11 pm
Reply with quote

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
View user's profile Send private message
chiranjeevi_mca

New User


Joined: 19 Feb 2006
Posts: 27

PostPosted: Wed Aug 02, 2006 10:22 am
Reply with quote

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
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Wed Aug 02, 2006 11:57 am
Reply with quote

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
View user's profile Send private message
bonniem

New User


Joined: 09 Aug 2005
Posts: 67

PostPosted: Wed Aug 02, 2006 12:24 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts SET PATH in View DDL DB2 2
Search our Forums:

Back to Top