SQL Queries & Scripts
WITH CTE AS(SELECT ResultTypeID, Info1, Info2, Info3, Info4,RN = ROW_NUMBER() OVER(PARTITION BY ResultTypeID, Info1, Info2, Info3, Info4 ORDER BY MatchPercentage DESC)FROM #tmpSearchResults)DELETE FROM CTE WHERE RN > 1 Note: In the Partition By section write the name of the Column or Columns you want to have unique.
DBCC CHECKIDENT (‘TableName’, RESEED, 0);GO Note: 0 is the number to which you want to reset. It could be any number. For example if you have 200 records but you want to keep only 10 records and delete the rest, then you may reset the seed to 10 so that the next insert will be for record id 11.