Is it possible to set a unique constraint on a dataset column but still allow null values?

  • Thread starter Thread starter Tim Frawley
  • Start date Start date
T

Tim Frawley

Is it possible to set a unique constraint on a dataset column but
still allow null values?
 
Yes, although after applying the constraint you may have only one row with a
null value in that column.
 
Ok, that is completely understandable, thank you Russell.

What I really need is a way to make sure that entries are unique while
allowing multiple null values. It works through a grid so limiting the
rows in the grid is not an option.

The only way I can see to do it is to create a dataview and filter that
for the new entries prior to setting the value on the grid. I was
hoping for something in the dataset rather than a function that fires
each time a value is created.
 
Hi Tim,

If your columns has a unique constraint, that means it is a primary key
column. So all the items in the column must be unique. You can not have
multi-items in that column are null values.(This will violate the unique
constraint)

I think if you still want to apply multi-null values to your column, you
should remove the unique constraint from that column.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Tim,

Does the community's reply make sense to you?

Please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top