Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003

    Unanswered: how to change a column size or data type

    hi friends,

    i would like to change a column size changed from startdate char(8) to char(10) with out dropping a table in db2 udb 7.1 EEE

    and is this possible (changing the data type of a column with out dropping the table), change startdate char(8) to startdate date

    i would appreciate if some one can show me how to use this command with an example,

    set data type varchar

    and can this command be used to change a column size.


  2. #2
    Join Date
    Jan 2003
    Provided Answers: 1

    According to my knowleadge changing the data type or size is only posible with recreating the table.
    Why are you using the char(8) for data type? Why don't you use the "date" data type?

    create table x (startdate date)

    Hope this helps,

  3. #3
    Join Date
    Jul 2003
    i'm working in a data warehouse eniv and in our source table we were having a date column defined as a char type and at the first run we created the same data type in target too, but then realized that it would be useful if we have the date defined as the date data type rather than char.

    and an another scenario was we needed to extend the sizes of couple of columns which were defined as char data type.

    i know in Oracle we could do it and i'm new to DB2 & don't even know if i could accomplish with dropping a table.

    i thought there is a way to change the size if the data type is varchar, would appreciate if some one can confirm if it can be done or not, if yes would appreciate if you can give an example.

    thanks for your response.
    Last edited by dbjon; 07-30-03 at 09:18.

  4. #4
    Join Date
    Aug 2001
    Unfortunately db2 is very, very restrictive on altering the structure of the table once defined ...

    There are a number of tools in the market which make life easier for such tasks
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts