If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Alter column in db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-09, 13:25
prasadv18 prasadv18 is offline
Registered User
 
Join Date: Nov 2007
Posts: 26
Alter column in db2

Hi team

In db2 is it possible to alter column datatype

example

I have a table in that one column datatype is int

i want to to make that column datatype as bigint

i know that in db2 we cant convert like that

except char and varchar

Please provide solution if any
Reply With Quote
  #2 (permalink)  
Old 01-26-09, 14:11
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
What version of db2 are you ?

If DB2 9, then you should be able to do it ...

DB2 Database for Linux, UNIX, and Windows

If you are on v8, search for ALT_OBJ procedure, which can do the job in the background or generate scripts to get the change done

HTH
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 01-26-09, 14:32
prasadv18 prasadv18 is offline
Registered User
 
Join Date: Nov 2007
Posts: 26
Thanks
if it is version 9 can i use commonds like this

db2 " alter table sample alter column col set data type bigint"

col is now int
Reply With Quote
  #4 (permalink)  
Old 01-27-09, 11:40
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
i guess so ... why not try it on a test table ?

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On