Why would you apply a checksum to a single column? That doesn't really make any sense to me. But, if you are intent to sticking with a checksum, here is a kind of a way you could solve the problem (I don't have time to make up real sample data so I just put the checksum in the table):DECLARE @Yak TABLE (Msg VARCHAR(50), CkSum INT)INSERT @YakSELECT 'Foo', 1UNION ALL SELECT 'Foo bar', 1UNION ALL SELECT 'I am yak!', 2UNION ALL SELECT 'Foo bar', 1UNION ALL SELECT 'I am yak!', 2-- 2005SELECT Msg, CkSumFROM ( SELECT Msg, CkSum, ROW_NUMBER() OVER (PARTITION BY CkSum ORDER BY Msg) AS RowNum FROM @Yak ) AS TempWHERE RowNum = 1-- 2000SELECT MIN(Msg), CkSumFROM @Yak GROUP BY CkSum
Hopefully, the sample shows well enough what you need to do. :)EDIT: I hit the button too fast.. Another option (although I wouldn't recommend it) is to set the IGNORE_DUP_KEY option on your PK to ON.