简体   繁体   中英

Error #1064 MySQL Syntax Error

I'm trying to import several brands into a table.

INSERT INTO fme_brands ( brand_id , brand_name , brand_website , brand_address , brand_logo , brand_featured , brand_contact_name , brand_contact_phone , brand_details , identifier , brand_page_title , brand_meta_keywords , brand_meta_description , status , created_time , update_time ) VALUES (141, 'Accu-Cable', 'www.americandj.com/ProductsList.aspx?Category=ACCU%20Cable', NULL, 'manufacturers/files/a/c/accu-cable.jpg', 0, NULL, NULL, NULL, 'accu-cable', 'Accu-Cable', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49');(142, 'Actasign', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'actasign', 'Actasign', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49');(143, 'Adam', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adam', 'Adam', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'); (144, 'ADI', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adi', 'ADI', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'); (145, 'ADJ', 'www.adj.com', NULL, 'manufacturers/files/a/m/american-dj_1.jpg', 0, NULL, NULL, NULL, 'american-dj', 'ADJ', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'); (146, 'Adobe', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adobe', 'Adobe', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'); (147, 'Aerial7', 'www.aerial7.com', NULL, 'manufacturers/files/a/e/aerial7.jpg', 0, NULL, NULL, NULL, 'aerial7', 'Aerial7', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'); (148, 'Akai Professional', 'www.akaipro.com', NULL, 'manufacturers/files/a/k/akai.gif', 0, NULL, NULL, NULL, 'akai-professional', 'Akai Professional', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49');

While the 1st line always imports correctly, I get syntax error saying "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '142, 'Actasign', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, N "

This leads me to believe that there is a problem with the parenthesis at the beginning of each line? Anyone know where I'm going wrong?

You need comma not semicolon after each value set: eg

From the manual :

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

Your query:

INSERT INTO fme_brands (brand_id, brand_name, brand_website, brand_address, brand_logo, brand_featured, brand_contact_name, brand_contact_phone, brand_details, identifier, brand_page_title, brand_meta_keywords, brand_meta_description, status, created_time, update_time) 
VALUES 
(141, 'Accu-Cable', 'www.americandj.com/ProductsList.aspx?Category=ACCU%20Cable', NULL, 'manufacturers/files/a/c/accu-cable.jpg', 0, NULL, NULL, NULL, 'accu-cable', 'Accu-Cable', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(142, 'Actasign', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'actasign', 'Actasign', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(143, 'Adam', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adam', 'Adam', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(144, 'ADI', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adi', 'ADI', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(145, 'ADJ', 'www.adj.com', NULL, 'manufacturers/files/a/m/american-dj_1.jpg', 0, NULL, NULL, NULL, 'american-dj', 'ADJ', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(146, 'Adobe', NULL, NULL, 'manufacturers/files/no_image_available.jpg', 0, NULL, NULL, NULL, 'adobe', 'Adobe', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(147, 'Aerial7', 'www.aerial7.com', NULL, 'manufacturers/files/a/e/aerial7.jpg', 0, NULL, NULL, NULL, 'aerial7', 'Aerial7', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49'),
(148, 'Akai Professional', 'www.akaipro.com', NULL, 'manufacturers/files/a/k/akai.gif', 0, NULL, NULL, NULL, 'akai-professional', 'Akai Professional', NULL, NULL, 1, '2015-11-17 00:01:49', '2015-11-17 00:01:49');

This is why your first value set imported in your query, because it was like the following:

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3); #ok
(4,5,6),(7,8,9); #error, no INSERT INTO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM