Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    36

    Angry Unanswered: How to add a not null constraint to an existing column

    Vesrion 8.1 FP5

    OS : Solaris 2.8


    Can we add a not null constratint to an existing column?
    If not what is the solution for this?

  2. #2
    Join Date
    Apr 2004
    Location
    Inside Intel
    Posts
    165

    Talking

    You have to drop the table and recreate it.

    Newbie

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    The other option you have is to add a check constraint by ALTERing the table ...

    ALTER TABLE TABLE1 ADD CONSTRAINT constraint1 check (col1 is not null)

    But, I do not have a definitive idea on the performance difference between a not null check constraint and a base table column definition ...

    Cheers
    Sathyaram
    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
  •