The general principle for finding duplicates is to simply use group by
and having count(*) > 1
If you just want to know the values โโof repeating columns:
select col1, col2 from table group by col1, col2 having count(*) > 1
If you want to see all fields in which two columns are duplicated:
select t.* from @tbl t where exists (select * from @tbl d where d.col1 = t.col1 and d.col2 = t.col2 group by d.col1 having COUNT(*) > 1)
source share