Prevent duplicate entries

Hi experts,

I have a sp that inserts (registers) user, how can I stop getting multiple entries of the same user, for example, an operator enters the following details:

First Name: Wayne
MiddleName: A
LastName : Atherton

the sp returns an out put value for the new user id, so how do I prevent another user being entered with exactly the same details, currently after i insert a new users a auto number is created to represent the user.


Who is Participating?
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
Just get your SP to check for an existing record first and return its ID if found, otherwise it adds it as a new record. Something like:

     IF NOT EXISTS(SELECT YourFields FROM YourTable WHERE YourCriteria)
         /* Insert a new record */
        /* Retrieve the existing record */
wathertonAuthor Commented:
thanks carl, job for the db team them - great stuff :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.