Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check the duplicated record in a .CSV file?

Status
Not open for further replies.

771212

Programmer
Oct 1, 2002
7
0
0
US
How to check the duplicated record in a .CSV file?

I am using the CSV to batch create user accounts, but I am facing a problem that if there is duplicated “username” in the .csv file, how can I catch it before I run into the real batch creating process.

For example, I have a .csv file like this:

Username, password, email
Abc, 1234, abc@yahoo.com
cba, 1234, cba@yahoo.com
Abc, 1234, abc@yahoo.com

Since the system won’t allow duplicated username, how do I find out there is (are) duplication(s) in the uploaded file.

Thank you for any help on this.
 
771212, where are you getting the original .CSV file from?

What you can do is upload the .CSV file to a temp table then run a SELECT statment like:
Code:
SELECT DISTINCT(username)
FROM TempTable

Then take that queryset results to create accounts.

____________________________________
Just Imagine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top