How can I load 10,000 rows of test.xls file into mysql db table? -


how can load 10,000 rows of test.xls file mysql db table?

when use below query shows error.

load data infile 'd:/test.xls' table karmaasolutions.tbl_candidatedetail (candidate_firstname,candidate_lastname);

enter image description here

my primary key candidateid , has below properties.

enter image description here

the test.xls contains data below. enter image description here

i have added rows starting candidateid 61 because upto 60 there candidates in table.

please suggest solutions.

to import data excel (or other program can produce text file) simple using load data command mysql command prompt.

save excel data csv file (in excel 2007 using save as) check saved file using text editor such notepad see looks like, i.e. delimiter used etc. start mysql command prompt (i’m lazy mysql query browser – tools – mysql command line client avoid having enter username , password etc.) enter command: load data local infile ‘c:\temp\yourfile.csv’ table database.table fields terminated ‘;’ enclosed ‘”‘ lines terminated ‘\r\n’ (field1, field2); [edit: make sure check single quotes (') , double quotes (") if copy , paste code - seems wordpress changing them similar different characters] done! quick , simple once know :)

some notes own import – may not apply if run different language version, mysql version, excel version etc…

terminated – why included step 2. thought csv default comma separated @ least in case semicolon deafult enclosed – data not enclosed left empty string ” lines terminated – @ first tried ‘\n’ had add ‘\r’ rid of carriage return character being imported database make sure if not import primary key field/column has auto increment on, otherwhise first row imported

original author reference


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -