?
Solved

Prevent duplicate entries

Posted on 2006-06-17
2
Medium Priority
?
215 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

752 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