Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2001
    Posts
    4

    Unanswered: change nullable column to not nullable

    I just want to alter a nullable column in DB2 to be NOT NULL...is that so wrong?? Can anyone give me the syntax or a handy work-around?? Thanks to all.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: change nullable column to not nullable

    In this case you cannot use ALTER TABLE.

    If you already have the table creation statement then it is fine. Otherwise use db2look to generate the DDL.

    Export the table data using the EXPORT Command.

    Drop and recreate the table and other related objects.

    Import the data back into the table using the IMPORT command.

    HTH

    Cheers

    Sathyaram


    Originally posted by luvcal
    I just want to alter a nullable column in DB2 to be NOT NULL...is that so wrong?? Can anyone give me the syntax or a handy work-around?? Thanks to all.

  3. #3
    Join Date
    May 2002
    Posts
    9
    Hi Satyaram,

    Not a reply but another question related to column altering, if i want to reduce the width of a column which is a primary key in the table what do i do.??

    Rgds,

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Unfortunately DB2 is very restrictive with changing column widths.

    You can only increase the length of a VARCHAR column. I am not sure the consequence if the column is a part of the primary key.

    HTH

    Cheers

    Sathyaram

    Originally posted by venkys_1
    Hi Satyaram,

    Not a reply but another question related to column altering, if i want to reduce the width of a column which is a primary key in the table what do i do.??

    Rgds,

  5. #5
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Unfortunately DB2 is very restrictive with changing column widths.

    You can only increase the length of a VARCHAR column. I am not sure the consequence if the column is a part of the primary key.

    HTH

    Cheers

    Sathyaram

    Originally posted by venkys_1
    Hi Satyaram,

    Not a reply but another question related to column altering, if i want to reduce the width of a column which is a primary key in the table what do i do.??

    Rgds,

Posting Permissions

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