Using SQL Server 2008, you can create a filtered index.
CREATE UNIQUE INDEX AK_MyTable_Column1 ON MyTable (Column1) WHERE Column1 IS NOT NULL
Another option is a trigger to check uniqueness, but this could affect performance.
More Related Contents:
- Foreign key constraint may cause cycles or multiple cascade paths?
- How important is the order of columns in indexes?
- Creating an index on a table variable
- What are Covering Indexes and Covered Queries in SQL Server?
- SQL Server indexes – ascending or descending, what difference does it make?
- SQL Server 2005 How Create a Unique Constraint?
- Turn off constraints temporarily (MS SQL)
- Does Foreign Key improve query performance?
- Postgres unique constraint vs index
- MS SQL “ON DELETE CASCADE” multiple foreign keys pointing to the same table?
- How to select only the first rows for each unique value of a column?
- SQL Server 2008- Get table constraints
- Deferrable Constraints in SQL Server
- sql unique constraint on a 2 columns combination
- What’s the difference between a Table Scan and a Clustered Index Scan?
- Slow bulk insert for table with many indexes
- Select distinct record from table and perform Sum of column (Pallats, Gross) of a duplicate row. And show that duplicate rows once [closed]
- Select top 10 records for each category
- What this query does to create comma delimited list SQL Server?
- Write a number with two decimal places SQL Server
- Selecting N rows in SQL Server
- A SQL Query to select a string between two known strings
- How can I INSERT data into two tables simultaneously in SQL Server?
- Group DateTime into 5,15,30 and 60 minute intervals
- Column name or number of supplied values does not match table definition
- SQL Group BY, Top N Items for each Group
- SQL UPDATE TOP with ORDER BY?
- How do I create a table alias in MySQL
- SUM total time in SQL Server [duplicate]
- can we have a foreign key which is not a primary key in any other table?