• Thank You for your reply,

    That was a sample data that i post, User can select anything from front end to merge, it could be max sid or min sid don't know. I agree with you Cursor is very bad, sometime if you don't have no choice then. I will check later to optimize my SP. Could you please help me to find the problem, why cursor is running infinite loop?

    Thank You.

    UPDATE #TableA

    SET IsActive = 1

    WHERE [SID] IN

    (SELECT MIN([SID]) AS GoodID

    FROM #TableA

    GROUP BY FName

    , LName

    , DOB

    , City);