Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    205

    Unanswered: About Unique Constraint with Nullable field - Urgent Plz

    Hi ,

    I have a requirement where I need to create a unique constraint which accepts null value. But in DB2, a unique constraint column should be defined with NOT NULL.
    How can i do this. ?

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Create a regular index on the column. In your program that inserts the row, if the value is not null, do a select to see if that value already exists. If the value already exists in the table and the value is not null, then process the data as a user error.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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