Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    7

    Unanswered: removing not null constraint in db2.

    is it possibel to delete the not null constraint in the db2? Please reply back immediately as this is urgent for us.

    Regards
    Shrini

  2. #2
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    62
    In DB2 z/OS: no if you talk about a column defined as NOT NULL. If you ensure it through a table constraint, then you can drop that constraint.

  3. #3
    Join Date
    Feb 2004
    Posts
    7
    Thanks Walter
    Dropping the table level constraint is possible. but any idea why the dropping the column level setting can't be rubbed off?

    Regards
    Shrini

  4. #4
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    62
    Hi

    I don't know, if my reply was clear. If you create your table as
    CREATE TABLE T1 ... COL1 SMALLINT NOT NULL, then you cannot change the null constraint, because DB2 does not offer this feature.

    If you create your table with CREATE TABLE T1 ... COL1 SMALLINT CHECK (COL1 IS NOT NULL) then you can drop this check constraint, by using ALTER TABLE T1 DROP constraintname.

Posting Permissions

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