import single column csv file into mysql using phpmyadmin -


i have single column csv file columns

mahindra logan  mahindra xylo maruti suzuki swift 

when view file notepad+ shows complete 514 lines when view in notepad , data combined , shown 3 lines. when import in phpmyadmin using csv using load data, , selecting "\n" columns terminated . 3-4 entries imported. please me out if possible

it might result of several things:

  1. if table has several columns , importing file 1 column, data truncated division e.g. assume have table called mytable 2 columns autoid , fname. file however, has 1 column , 20 rows. autoid auto-increment column in case. if use command:

    load data local infile 'c:\\myfile.csv' table mydatabase.mytable 

    only ten rows of data imported. reason is, mysql assumes trying import single column of data 2 columns of data. however, since autoid values automatically generated, values inserted discarded. solve such problem, did following. opened csv file in excel , added column left of existing column null values. sql statement ended being like"

    load data local infile 'c:\\myfile.csv' table mydatabase.mytable fields terminated ',' lines terminated '\n' 

    my file looked like:

    null, james, null, john, 
  2. make sure column values delimited i.e. if above values wanted import mysql table. use following command

    load data local infile 'c:\\myfile.csv' table mydatabase.mytable fields terminated ',' lines terminated '\n' 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -