add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t ( a int, b int, c int, d int) ;
alter table t add unique(b, c);
insert into t (a, b, c, d) values (1, 1, 1, 1), (2, 2, null, 2), (3, 2, null, null);
Msg 2627 Level 14 State 1 Line 1
Violation of UNIQUE KEY constraint 'UQ__t__A86D1816648685EC'. Cannot insert duplicate key in object 'dbo.t'. The duplicate key value is (2, <NULL>).
Msg 3621 Level 0 State 0 Line 1
The statement has been terminated.
select * from t;
a b c d