Create an unique index on a nullable column in a temporary table

create table #Difference
(
branch_id int,
sku_id int,
serial_number nvarchar(100),
quantity int
)
create unique index #IX_Difference1 on #Difference(serial_number) where serial_number is not null

Advertisements