Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ignore duplicate entries with sql loader?

Posted on 2008-10-24
2
Medium Priority
?
1,051 Views
Last Modified: 2010-04-21
HI, I have a table that has a primary key column. I need to enter some values into this table using sql loader (this table has existing data in it). When uploading these new values if a duplicate row is encoutered I need the loader to ignore that record and continue to load the remaining data. How can this be done? The script I am using is
load data infile 'c:/channel_lineups/load/states.txt'into table `state` (state_id, state_name, id);
where state_id is the primary key.

Thanks for the help.

A
0
Comment
Question by:aej1973
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
Umesh earned 400 total points
ID: 22798608
Try this...

LOAD DATA INFILE  'c:/channel_lineups/load/states.txt' IGNORE into table `state` (state_id, state_name, id);

Make use of IGNORE keyword in the LOAD statement. If you specify IGNORE, input rows that duplicate an existing row on a unique key value are skipped.

BTW, you can check the syntax..

http://dev.mysql.com/doc/refman/5.0/en/load-data.html
0
 

Author Closing Comment

by:aej1973
ID: 31509742
Excellent, thank you very much.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question