Wrox Programmer Forums
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 10th, 2008, 06:02 AM
Authorized User
Join Date: Nov 2005
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.................


Old March 10th, 2008, 11:24 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

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)

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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.