Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 10th, 2008, 06:02 AM
Authorized User
 
Join Date: Nov 2005
Location: Colombo, , Sri Lanka.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stop duplicate record

Heloo all,

how i show messege if i entering details already stored in my sqlserver 2000 database.
This's my problem.
I have insert some customer details.But if i try to add same customer details again and again i want to show it already inserted. So let me know how i do thath thing.................

thankyou

MSB
__________________
MSB
Reply With Quote
  #2 (permalink)  
Old March 10th, 2008, 11:24 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The traditional way to do this is to use the database's integrity features, a composite primary key for instance, but it sounds like this is not an option. So maybe use a trigger. You decide which fields constitute a duplicate, let's say first name, last name and post code. Create a trigger that runs on insertions and check whether the data in these three fields already exists in one row in the table. If it does reject the insertion and raise an error.

--

Joe (Microsoft MVP - XML)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Record insersion nishanthahe BOOK: Beginning ASP.NET 2.0 and Databases 1 November 5th, 2008 04:38 PM
Stop button won't stop loop JDShaffer Visual Basic 2008 Essentials 3 May 23rd, 2008 03:22 PM
Display Record Frm 2Diff Tables&Without Duplicate future Classic ASP Databases 3 November 12th, 2006 12:16 PM
Subform allows end-user to make duplicate record pkaptein1 Access 7 May 25th, 2005 11:34 AM
Checking for duplicate record in jsp Regornil JSP Basics 0 July 30th, 2004 01:55 AM



All times are GMT -4. The time now is 01:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.