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
 
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 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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

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