I have a requirement where i have two records with same value except the PK. how can i delete one of them.I have plenty of such duplicate records.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One solution is to write a procedure that opens a cursor to a query ordered by the columns that define duplicates, and use
DELETE ... WHERE CURRENT OF CURSORwhen the row is a duplicate of the previous row. Here’s pseudocode for what I mean: