Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE VIEW vw_unq WITH SCHEMABINDING AS
- SELECT Column1
- FROM MyTable
- WHERE Column1 IS NOT NULL
- CREATE UNIQUE CLUSTERED INDEX unq_idx ON vw_unq (Column1)
- CREATE TABLE dupNulls (
- pk int identity(1,1) primary key,
- X int NULL,
- nullbuster as (case when X is null then pk else 0 end),
- CONSTRAINT dupNulls_uqX UNIQUE (X,nullbuster)
- )
Add Comment
Please, Sign In to add comment