?
Solved

Prevent duplicate entries

Posted on 2006-06-17
2
Medium Priority
?
216 Views
Last Modified: 2010-07-27
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
etc......


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.

cheers

Wayne
0
Comment
Question by:watherton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 400 total points
ID: 16926905
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)
     BEGIN
         /* Insert a new record */
     END
     ELSE
     BEGIN
        /* Retrieve the existing record */
     END
0
 

Author Comment

by:watherton
ID: 16927092
thanks carl, job for the db team them - great stuff :-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question