General information
Forum:
Microsoft SQL Server
Ok I get it, I'm always a bit slow off the mark..
Jon
>Jon,
>
>I think he's wanting to check that the value is either null or a single other value. So the set of possible values is something like: ( null, 'fred' )
>
>>So you want to have a field that allows nulls but all non null values should be unique? Is this correct?
>>
>>If so then you cannot use a primary or unique constraint, as David suggests add a check constraint on the field to ensure its uniqueness. You could also, if you want, do this validation through a trigger but the Check constraint would be the best way to do this.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only