When the primary key is imported, a large number of errors will be reported.
Query:
INSERT INTO `FNDCN_ MNG ` values (787390578, 1, ‘Yang Ming’, 95585, ‘2015-06-08′,’prospectus’, 80100, null, ‘1’, null, ‘3’, 2015-06-29 ‘, null,’ 1 ‘,’yang Ming, master of Central University of Finance and economics, 14 years of banking and fund experience. He worked as a credit officer, trader and risk manager in Bank of Shanghai. In October 2004, he joined Huaan Fund Management Co., Ltd. as a researcher of research and development department. Since June 2013, he has been the fund manager of Huaan strategic preferred equity fund. He has been the senior director of investment research since June 2014. ‘, ‘2015-11-09 12:33:58’, ‘2016-01-06 21:34:41’, ‘2015-12-31 12:14:18’, ‘JY’, ‘488969752640’, NULL, NULL, NULL, NULL)
Error occured at:2016-02-16 15:23:41
Line no.:220
Error Code: 1062 – Duplicate entry ‘95585-80100-2015-06-29 00:00:00-1–1’ for key ‘IDX_ FNDCN_ MNG’
Solution 1:
Set the primary key to grow automatically. You can manually set the related table ID to self growing in the database.
As shown in the figure:
Continue to import normal.
Solution 2:
Problem Description: if the SQL is imported separately, the following error will be reported:
1 queries executed, 0 success, 1 errors, 0 warnings
Query: insert into ` fndcn_ MNG ` values (787192513, 1, ‘Dingjin’, 150150, ‘2015-12-28’, ‘prospectus’, 80100, null,’ 1 ‘, null,’ 3 ‘, 20
Error code: 1062
Duplicate entry ‘787192513’ for key ‘PRIMARY’
After checking, the primary key generation strategy is: @ generatedvalue (strategy)= GenerationType.IDENTITY )No problem.
Delete the table with import error;
Create a new table to import data;
My problem is in the database: in the database, the primary key is not set to grow automatically. Set the primary key of the existing table to grow automatically. The SQL statement is as follows:
alter table course change course_ id course_ id int(10) not null auto_ increment ;
Then use SQL script to import the required data, which can also easily locate errors.
Read More:
- The solution of duplicate entry ‘for key’ primary ‘when inserting data in MySQL
- Txt import MySQL: error 1062 (23000): duplicate entry ‘0’ for key ‘primary’
- Solution of duplicate entry ‘value’ for key ‘field name’ in MySQL
- [reprint and save] MySQL does not set the primary key and uses the self growing ID method
- E11000 duplicate key error collection in mongodb
- Dbsql occurs when configuring SAP ATC during SCI check_DUPLICATE_KEY_ERROR
- mysql Error Code: 1022. Can’t write; duplicate key in table `xxx`
- pymongo.errors.DuplicateKeyError: E11000 duplicate key error collection: anjuke.ershoufang index
- sqoop-import ERROR tool.ImportTool: Import failed: No primary key could be found for table user_info
- Lambda set to map duplicate key error solution
- Mongoose Error: e11000 duplicate key error collection, code: 11000
- [Python CONDA error] cache entry design failed, entry ignored error resolution
- MySQL creates tables and sets auto increment of primary keys
- Syntax error or access violation: 1071 specified key was too long; max key length is 767 bytes
- How to prevent duplicate submission
- Expected primary expression before ‘unsigned’ solution
- A simple method of generating secret key by GIT and configuring SSH public key
- docker apache php-fpm AH01071: Got error ‘Primary script unknown\n’
- MySQL failed to add foreign key: SQL 1452 cannot add or update a child row:a foreign key constraint fails
- Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes