hello! How do I delete a duplicate records in sql? I have autonumber number primary key.
Printable View
hello! How do I delete a duplicate records in sql? I have autonumber number primary key.
this is what i have in my table
36918 EL20080752 CARIAGA ADRIAN PAUL R. MALE LC4 READING4 NULL St. Gemma
36930 EL20080752 CARIAGA ADRIAN PAUL R. MALE LC4 READING4 NULL St. Gemma
36931 EL20080753 CLAVEL ZYRIL JAY F. MALE LC4 READING4 NULL St. Gemma
36943 EL20080753 CLAVEL ZYRIL JAY F. MALE LC4 READING4 NULL St. Gemma
36944 EL20080754 DELA TORRE CHRISTIAN FELIX T. MALE LC4 READING4 NULL St. Gemma
36956 EL20080754 DELA TORRE CHRISTIAN FELIX T. MALE LC4 READING4 NULL St. Gemma
36957 EL20080755 DIAZON MARK JOSEPH M. MALE LC4 READING4 NULL St. Gemma
I'd say you have two options (assuming dups are in fact identical).
That is you could have a Dup where the name is slightly misspelled,
upper/lower case may also play a role.
==============================
1) Set up a Key for the fldName Address String.
2) Load in the first record and seek others similiar strings.
3) If found delete it (assume you want to keep the first occurance)
4) Continues looping through the DB (until .EOF), repeating
the next record, seek, etc.
=================
With SQL you may be able to do a Query and Group by the Name Addr field
but then you would have to manually delete dups.
how do i do it in sql management studio? I am using vb2005 and sql2005
This may work for you.
http://blog.sqlauthority.com/2007/03...-records-rows/