Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unique Index and duplicate nulls in DB2

Status
Not open for further replies.

cotaurus

Technical User
Oct 15, 2002
9
0
0
US
Hi all.

I have a table with two columns, a primary key and the other column must be unique index to avoid duplicate values, but allowing multiple nulls. The unique index in DB2 for UNIX does not allow duplicate nulls. How can I solve this issue? Any ideas using triggers or something?

Thanks in advance.
 
Hello db2ttips,

Sounds like this does not really add up. If your first column is the primary key, it will ensure that you will not have duplicate values in the table. You can set a non-unique index if you want your second column to be null. It is the primary key that will ensure that you avoid duplicates....
T. Blom
Information analyst
tbl@shimano-eu.com
 
Thanks for your reply Mr.Blom. The situation is that besides the primary key, I dont want duplicates in the second column, but I can allow nulls. I think I was not clear enough from the beginning.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top