Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DB2 , how to view structure of a table , indexing

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: DB2 , how to view structure of a table , indexing
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: 238
Location: USA

PostPosted: Thu Feb 19, 2004 2:11 pm    Post subject:
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    Post subject:
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    Post subject: Re: DB2 , how to view structure of a table , indexing
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    Post subject:
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    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 Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts REXX to view the PGM or PROC jackzhang75 CLIST & REXX 11 Tue Jun 20, 2017 1:20 am
No new posts How to see VIEW definition from BMC c... rohanthengal DB2 1 Thu May 04, 2017 1:50 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us