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

What is the query to change the attributes


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

New User


Joined: 16 Sep 2005
Posts: 7

PostPosted: Fri Sep 23, 2005 4:30 pm
Reply with quote

hello sir/madam,

thank for ur valuable article o have send to me, now i am having another doubt in DB2 . in db2 we will creat etable like ( create table emp(empno char(5)) ) now i want to change thae attribute means i want to change char(5) to char (7) or varchar (5) ) what is the querruy to change the attributes plz clarify my doubts
Back to top
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Fri Sep 23, 2005 7:12 pm
Reply with quote

ALTER COLUMN columnname SET DATATYPE VARCHAR (integer)

It Alters the definition of a column. Only the length attribute of an existing column with a VARCHAR data type can be changed. A column cannot be altered if it is used in a referential constraint or a view or has a field procedure routine. It also cannot be altered if it belongs to a table that has edit or validation routine, is defined with DATA CAPTURE CHANGES, or is a created temporary table.

check this link:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/5.10?DT=20010718164132

So, in your case you cannot alter the column, as it is fixed, that is, CHAR.

If you really want to alter the table then you can take a back up of the table and drop the table and recreate it with new column definitions and load the table back with backup data.

Hope this helps...

Cheers,
Kumar.
Back to top
View user's profile Send private message
senthilkumarse
Warnings : 1

New User


Joined: 16 Sep 2005
Posts: 7

PostPosted: Fri Sep 30, 2005 11:45 am
Reply with quote

thanks for ur valuable article

now i have one doubt what is AMP where we r using this in one interviem they asked to my friends he is not able to answer this so plz clear my doubt
Back to top
View user's profile Send private message
suganthyprabha

New User


Joined: 28 Jul 2005
Posts: 58

PostPosted: Fri Sep 30, 2005 12:43 pm
Reply with quote

Hi Ikumar,

I am having doubt on this. Is it possible to change the Lenght of

Column in Mainframes?


Thanks and Regards,
Suganthy.
Back to top
View user's profile Send private message
senthilkumarse
Warnings : 1

New User


Joined: 16 Sep 2005
Posts: 7

PostPosted: Fri Sep 30, 2005 1:34 pm
Reply with quote

I am also having the same doubt on this, but i tried this i cant change it,
some others also replied the same thing for me that we cant change if u found out thae correct ans inform to me
Back to top
View user's profile Send private message
ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Fri Sep 30, 2005 5:20 pm
Reply with quote

Hi Suganthy,

we cannot change the length of the column in DB2 unless if it is a VARCHAR field (see my previous post on this).
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 RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
Search our Forums:

Back to Top