How to insert into my table from a file in mysql? -


i have file.dat follow:

"evan","e","wallis","222222200","1958-01-16","134 pelham, milwaukee, wi","m","92000.00",null,"7" "jared","d","james","111111100","1966-10-10","123 peachtree, atlanta, ga","m","85000.00",null,"6" 

i insert these values table.

i tried following did not succeed.

load data local infile "c:/file.dat"  table table ; 

there no error there warning , table not filled data.

load data local infile "c:/file.dat" table table 0 row(s) affected, 64 warning(s): 1265 data truncated column 'fname' @ row 1 1261 row 1 doesn't contain data columns...  

here how table created.

create table table(   fname    varchar(15) not null,    minit    varchar(1),   lname    varchar(15) not null,   ssn      char(9),   bdate    date,   address  varchar(50),   sex      char,   salary   decimal(10,2),   superssn char(9),   dno      integer(4),   primary key (ssn),   foreign key (superssn) references employee(ssn) ); 

by default, mysql looking tab-separated file. try following:

load data local infile "c:/file.dat"  table table fields terminated ',' enclosed '"' ; 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -