List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:June 17 1999 6:53pm
Subject:Re: loading data from a file
View as plain text  
"Sandrine C." wrote:
> 
> I want to lad data from a file. this operation works if i dont specify any
> character for teh end of line but if i put some characters.. then it deosnt
> work anymore! but i willneed some special character for other table. how
> shall i do ??
> here is the files :
> 
> mysql essai_temp << !EOF
> delete from organisme ;
> 
> LOAD DATA INFILE "/home/PFE-programmation/TEST/load/organisme_load"
>         INTO TABLE organisme
>         FIELDS TERMINATED BY ','
>         ENCLOSED BY '\''
>         LINES TERMINATED BY '**$**';
> !EOF
> /usr/bin/mysqladmin reload
> 
> and here is the file organisme_load :
> NULL, 'CAFAL', 'Caisse d Alloc ', '1', 'public', 'Locale' , '1', '1', 'En
> Attente', '1994-02-04'**$**
> NULL, 'CRCI', 'Chambre de Comm...', '2', 'public', 'Regionale' , '2', '2',
> 'Actif', ''**$**
> NULL, 'Orga Spé', 'Organisme Spécial !', '11', 'public', 'Regionale' ,
> '2',
> '2', 'Actif', '' **$**
> NULL, 'lola', ' l\'Organisme LOLMA...', '11', 'public', 'Regionale' , '2',
> '2', 'Actif', '' **$**
> 
> THANK YOU VERY MUCH FOR YOUR HELP
> Sandrine

Hi Sandrine

You obviously didn't remove all whitespace caracters from your data file.
What I mean is all the spaces,tabs and newlines between the terminating commas and the
enclosing quotes should be removed.
Yor data file should look like this:
NULL,'CAFAL','Caisse d Alloc ','1','public','Locale','1','1','En 
Attente','1994-02-04'**$**NULL,'CRCI','Chambre de
Comm...','2','public','Regionale','2','2','Actif',''**$**NULL,'Orga
Spé','Organisme Spécial
!','11','public','Regionale','2','2','Actif',''**$**NULL,'lola',' l\'Organisme
LOLMA...','11','public','Regionale','2','2','Actif',''**$**

There should also be no newline behind the last '**$**'.

Hope this was your problem.

Tschau
Christian

PS: Please give us next time a full example with problem description.
    To figure out your problem has cost me half an hour, to fix it 5 minutes.

Thread
loading data from a fileSandrine C .16 Jun
  • Re: loading data from a fileChristian Mack17 Jun