J G
asked on
Access table Index ignoring Nulls when set to No
I have a 3 field table index:
PLU
Vendor_Name
Order_Code
Index Properties:
Primary - No
Unique - Yes
Ignore Nulls - No
I am still able to create duplicate records in the table when Order_Code field is unpopulated/blank. If I enter a duplicate order_code value (lets say "01"), the index works, and will not allow me to create the record.
Why isn't the index working when I leave the field blank?
PLU
Vendor_Name
Order_Code
Index Properties:
Primary - No
Unique - Yes
Ignore Nulls - No
I am still able to create duplicate records in the table when Order_Code field is unpopulated/blank. If I enter a duplicate order_code value (lets say "01"), the index works, and will not allow me to create the record.
Why isn't the index working when I leave the field blank?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Allowing null in a field that is part of a unique index is handled differently by various RDBMS. If this field is a string, you can set the AllowZLS property to Yes and that will allow you to store one "blank" value. If the field is numeric and is not a foreign key, you can use some arbitrary high or low value but your queries will have to always interpret that value. I would need to understand more about the purpose of the field and why null is a valid value to offer more concrete suggestions.
ASKER