I am trying to insert data from a csv file into mysql using BigDump.
It stops on line 2, with the error:
"Query: INSERT INTO location VALUES
(1,"O1","","","",0.0000,0.0000,, );
MySQL: 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 ' )' at line 1"
If I run the statement from withing phpmyadmin, it says:
"#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 ' )' at line 1"
What can I do to make the data get into the database?
Thank you.
The commas with no values looks sketchy to me.
INSERT INTO location VALUES (1,"O1","","","",0.0000,0.0000,, );
should probably be
INSERT INTO location VALUES (1,"O1","","","",0.0000,0.0000,NULL,
NULL);
Does your insert statement contain values for every column in the table? If not, you have to name the columns.
For example,
insert into location (col1, col2, col3) values (1, 2, 3);
If you show us the structure of the LOCATION table you can get better answers.
Related
I'm creating a stored procedure using phpmyadmin for mysql 5.5.55 .
INSERT INTO drama_ (value1,value2,value3,value4,value5,value6)
VALUES (val1,val2,0,0,0,0);
SELECT LAST_INSERT_ID();
but i'm getting a syntax error in SELECT LAST_INSERT_ID();
EDIT :
You have an error your SQL syntax: check the manual that corresponds to your MYSQL server version for the right syntax to use near 'SELECT LAST_INSERT_ID()' at line 4
My code keeps giving me the following error:
#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 'INSERT INTO tags (id, name) VALUES (1, 'Web Design')' at
line 2
I'm running the code on phpMyAdmin. Here is the code:
USE home_blog
INSERT INTO tags (`id`, `name`)
VALUES (1, 'Web Design');
id is an int and name is a varchar. I found similar problems, but they were all fixed by reserved word issues or missing parentheses. Unless I'm completely blind I don't those issues.
USE and INSERT are 2 different statements, like 2 queries. You need to write ";" at the very end of all statements if you want to execute them in the row.
Where is the error in this query?
INSERT INTO chat (`id`,`user`,`message`,`date`)
VALUES (null,'user','test',CURRENT_TIMESTAMP);
This is the error message I receive:
"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 ''id','user','message','date') VALUES (null,'user','test',CURRENT_TIMESTAMP)' at line 1"
if the id is autoincrement then use this instead
INSERT INTO `chat` (`user`,`message`,`date`)
VALUES ('user','test',NOW());
Its difference between single quote ' and backtick `
What is the problem with this query?
INSERT INTO acfrac (username,id,count,time) VALUES ("John Smith", 10, 0,2006-06-07 09:44:33.0)
It gives me the following error:
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 '09:44:33.0)' at line 1
You need to quote your time stamp. In mysql, if the field you're entering is not an integer, it must be quoted.
Try this:
INSERT INTO acfrac (username,id,count,time) VALUES ("John Smith", 10, 0,'2006-06-07 09:44:33.0')
The date and datetime values need to be enclosed in single quotes.
I have this SQL query:
insert into messages
(message, hash, date_add)
values
('message', 'hash', NOW())
ON DUPLICATE KEY IGNORE
hash is unique, what is wrong with query? i got the error:
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 'IGNORE' at line 1
According to MySQL doc the syntax should be :
INSERT IGNORE INTO messages (message, hash, date_add)
VALUES('message', 'hash', NOW());