The proper way to implement unique constraint that allows multiple NULL values in SQL Server

前端 未结 3 1917
臣服心动
臣服心动 2020-12-17 19:52


I need 1 column in the table to hold unique non-null values or NULL. TSQL UNIQUE constraint treats 2 NULLs as equal, so I cannot

3条回答
  •  天命终不由人
    2020-12-17 20:36

    SQL 2008 allows you to define a filtered index - essentially an index with a WHERE clause - see Phil Haselden's asnwer to this question for MSDN links and an example.

提交回复
热议问题