I have column in a table that allow null but i want to make constraint that make him null or unique … How can i do that ?
Note : I validate it from the frontend but i want to have a physical in sql server that allow this even developer try to enter data
I have column in a table that allow null but i want to make
Share
An alternative to a filtered index that works on SQL Server 2000 and later is an indexed view.
Something like:
Note that you don’t have to do anything special once this view is created – you need never refer to it again. It will simply cause constraint violations to occur, if there is an attempt to insert non-unique values in the base table.
@marc_s – I beg to differ. They’re certainly not considered automatically (in query compilation) in editions below Enterprise, but they’re definitely creatable, and work as DRI enforcers in all editions:
Results:
And: