Link to home
Start Free TrialLog in
Avatar of dkim18
dkim18

asked on

Stored Procedure to insert a new record and update if there is a duplicate already??

Can you show me an example of some sort please?

I am trying to write up a stored procedure to insert a new record if there is no same record already exist but update if there is a same record already.

Right now I insert them first and check for the duplicate and delete the first one.

I want to combine those into one stored procedure.

Use this as example.
people(lastname, firstname, ssn,address)

If there is no record with same lastname and first, then insert this record.
But if there is a record with the same lastname and firstname, update this record.

Thanks much.
ASKER CERTIFIED SOLUTION
Avatar of dready
dready

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial