Here is simple e.g
Here is my sample data
IDSIDFNAMELNAMEDOBCITYIsActive
2245SmithJohn1998-01-10Los Angles0
3298SmithJohn1998-01-10Los Angles0
4987SmithJohn1998-01-10Los Angles0
If I select in sp, SID = 245,Fname=Smith,Lname = John and DOB = 1998-01-10 is right, rest all the data in the data with Fname=Smith,Lname = John and DOB = 1998-01-10 to inactive, it could be 4/5/ or any numbers, so that's why i am using Cursor inside SP,
Exec Merge '245','smith','john','1998-01-10'
IDSIDFNAMELNAMEDOBCITYIsActive
2245SmithJohn1998-01-10Los Angles0
3298SmithJohn1998-01-10Los Angles1
4987SmithJohn1998-01-10Los Angles1
So end result should be like this from sample data,
make sense?