create table #tab (custno int not null,lineseqno int not null,value varchar(2))
insert into #tab values(2343,3,'DP')
insert into #tab values(2432,4,'VP')
insert into #tab values(2343,3,'IP')
DELETE a from #tab a where exists (select 1 from #tab where custno=a.custno and lineseqno=a.lineseqno ) and value<>(select top 1 value from #tab where custno=a.custno and lineseqno=a.lineseqno)
select * from #tab
alter table #tab add constraint pk_#tab primary key (custno,lineseqno)
custno lineseqno value
----------- ----------- -----
2343 3 DP
2432 4 VP
(2 行受影响)