Results 1 to 5 of 5

Thread: Duplicate Records

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Sudbury, Ontario ,Canada
    Posts
    3

    Post

    How do I check for duplicate records in
    a field that does not allow duplicates.

    jim

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    If the field already does not allow duplicates, it will perform the validation for you. All you have to do is handle the error that will be generated

  3. #3
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Tom, there are instances in SQL server when you can have a field that does not allow duplicates that has them. BCP, for example, can do this on SQL Server.

    smartbid,

    select key, count(key) from table group by key

    will give you a list of all your keys (replace the word 'key' with your fieldname) and the number of times they occur. If you get a count greater than 1, you have duplicates.

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Would that be the exception, not the rule?

    Is it not wise to allow the DBMS to perform the validation with normal transactions?

  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Definitely.

    Sometimes you don't get a choice, BCP is a good example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width