Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2015
    Posts
    1

    Unanswered: Adding a new column

    I want to add a new column in existing table, and trying to run the below query but it is failing please help:

    AlTER table BO_ENTITLEMENTS ADD ACCOUNT_CONTROLLERS_LEVEL_TWO VARCHAR(100) NOT NULL;

    it is asking either default should be added or something.....

    so I added as:
    AlTER table BO_ENTITLEMENTS ADD ACCOUNT_CONTROLLERS_LEVEL_TWO VARCHAR(100) DEFAULT NOT NULL

    but it says it is a invalid statement.

    Please help.

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    You can't add a not null column without specifying a default value.

    What's your db2 version?
    What exact error code and message do you get?

    this works on my db2 for luw 9.7.6:
    Code:
    create table BO_ENTITLEMENTS (i int) in userspace1;
    AlTER table BO_ENTITLEMENTS ADD ACCOUNT_CONTROLLERS_LEVEL_TWO VARCHAR(100) DEFAULT NOT NULL;
    Regards,
    Mark.

Posting Permissions

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