#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2006
    Posts
    2
    Rep Power
    0

    Alter Table Command


    Hi All

    I am new to Db2.
    I am trying to alter a table by adding six new columns to it.

    I am not able to do so in a single shot.

    I am able to add a single column at a time.

    Does DB2 allows multiple column additions to a table in one alter table command.

    Please help.

    Thanks in Advance
    Ankit
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2006
    Posts
    3
    Rep Power
    0
    Yes DB2 allow inserting multiple columns in one time. If you are able to do them one at a time you are missing something whene trying all of them at once.

    What version of DB2 you have annd on which platform.
    I currently use DB2 on the AS/400.

    You could also try to post the code here to havea look.



    charles
    --------------------------
    (URL address blocked: See forum rules)
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2006
    Posts
    2
    Rep Power
    0
    I got this example from (URL address blocked: See forums rules)=/com.ibm.db2.udb.doc/admin/r0000888.htm

    Example 8: Alter the EMPLOYEE table to add 4 new columns with default values.

    ALTER TABLE EMPLOYEE
    ADD COLUMN HEIGHT MEASURE DEFAULT MEASURE(1)
    ADD COLUMN BIRTHDAY BIRTHDATE DEFAULT DATE('01-01-1850')
    ADD COLUMN FLAGS BLOB(1M) DEFAULT BLOB(X'01')
    ADD COLUMN PHOTO PICTURE DEFAULT BLOB(X'00')

    neodaba
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    Thumbs up Try this works


    ALTER TABLE BXKTLZ4T.CUSTOMER
    ADD CUST_SAL INTEGER
    ADD CUST_DESIGNATION VARCHAR(20)
    ADD CUST_OFC_ADDRESS VARCHAR(50);

    BXKTLZ4T-->schema name
    CUSTOMER-->table Name
    Imp thing is dont put comma after every statement

IMN logo majestic logo threadwatch logo seochat tools logo