#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Mystery about 2 identical CSV files


    Dear all,

    I've got two identical CSV files. One come from OpenOffice and the other come from a text substitution program.

    When I later go to upload and test them the OO file works like a charm and the TXT do not give error but no records are uploaded.
    If you check with text differences program there are not differences between them.
    I'm super stucked here from about two days and I've not uncovered the mistery.
    Please have a look and help me.... ;-)
    Super thanks
    Giò


    The mySQL SQL is the following:

    load data local infile 'file_name.csv'
    INTO TABLE members_file_fmi_input FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'
    IGNORE 1 LINES
    (Cod_Meccanografico ,
    Tessera , Nuo_Rin , Cognome , Nome , Sesso , Data_Nascita , Luogo_Nascita , Indirizzo , Cap , Citta , Provincia ,
    Data_Rilascio , Cod_MC , Motoclub , Telefono , Cellulare , Email , Cittadinanza , Residenza , Dirigente, year_card_actual)
    SET Data_Nascita = str_to_date(Data_Nascita, '%d%m%Y'),
    Provincia = '105',
    Data_Rilascio = str_to_date(Data_Rilascio, '%d%m%Y'),
    Motoclub = trim(Motoclub),
    Dirigente = IF (Dirigente <> '', Dirigente, '') ,
    year_card_actual = LEFT (Data_Rilascio, 4)

    SQL table and TT e OO csv files (file_name.csv)


    --
    -- Struttura della tabella `members_file_fmi_input`
    --

    CREATE TABLE IF NOT EXISTS `members_file_fmi_input` (
    `Cod_Meccanografico` varchar(64) NOT NULL DEFAULT '',
    `Tessera` varchar(64) NOT NULL DEFAULT '',
    `Nuo_Rin` varchar(64) DEFAULT NULL,
    `Cognome` varchar(128) DEFAULT NULL,
    `Nome` varchar(64) DEFAULT NULL,
    `Sesso` varchar(64) DEFAULT NULL,
    `Data_Nascita` varchar(10) DEFAULT NULL,
    `Luogo_Nascita` varchar(64) DEFAULT NULL,
    `Indirizzo` varchar(64) DEFAULT NULL,
    `Cap` varchar(64) DEFAULT NULL,
    `Citta` varchar(64) DEFAULT NULL,
    `Provincia` varchar(64) DEFAULT NULL,
    `Data_Rilascio` varchar(10) DEFAULT NULL,
    `Cod_MC` varchar(64) DEFAULT NULL,
    `Motoclub` varchar(128) DEFAULT NULL,
    `Telefono` varchar(64) DEFAULT NULL,
    `Cellulare` varchar(64) DEFAULT NULL,
    `Email` varchar(64) DEFAULT NULL,
    `Cittadinanza` varchar(64) DEFAULT NULL,
    `Residenza` varchar(64) DEFAULT NULL,
    `Dirigente` varchar(64) DEFAULT NULL,
    `year_card_actual` int(11) DEFAULT NULL,
    PRIMARY KEY (`Tessera`),
    UNIQUE KEY `key_Name_Year_Meccan` (`Cognome`,`Nome`,`year_card_actual`,`Cod_Meccanografico`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    --
    -- Dump dei dati per la tabella `members_file_fmi_input`
    --

    OO.csv
    TT.csv
    How can I attach these two files ??
  2. #2
  3. No Profile Picture
    Problem Solver
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2001
    Location
    Stockholm, Sweden
    Posts
    4,495
    Rep Power
    534
    Unfortunately there isn't enough information in your post.

    But my guess is that you have edited in the wrong code page or unix/windows line breaks differ (although I don't remember exactly if MySQL was sensitive to this).

    But if you pipe them into the mysql command line frontend it will give you usable error messages.
    /Stefan
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Where now I'm


    Stefan, thanks

    now I've produced in 'some' way this CSV file.
    I need to delete last ',' comma from each line.
    I'm really stuked here becouse I'm a php newbie
    Why if use a text editor it seems fine and if you make linux diff command there come out differences ??
    Have you got a sample code to delete last rows comma ?


    "Cod. Meccanografico","Tessera","Nuo./Rin.","Cognome","Nome","Sesso","Data Nascita","Luogo Nascita","Indirizzo","Cap","Città","Provincia","Data Rilascio","Cod. MC","Motoclub","Telefono","Cellulare","Email","Cittadinanza","Residenza","Dirigente",
    " 00018067","13082052","R","CHIOZZA","GIOVANNI","M","01011957","SCHIO","VIA PASINI 15","36015","SCHIO","VI","27122012","0351","SCHIO ","0445526536","348-8895768","giovanni.chiozza@libero.it","I","S","CS",
    " 00056962","13082053","R","DALLE CARBONARE","GIANANTONIO","M","21101959","RICHTERSWIL","VIALE ROMA 92/1","36015","SCHIO","VI","27122012","0351","SCHIO ","","335484789","gianantonio.dallecarbonare@elettroveneta.it","I","S","CS",
    " 12901018","13082051","R","GIORDAN","ALBERTO","M","02121966","THIENE","VIA LUNGA LEOGRA","36015","SCHIO","VI","27122012","0351","SCHIO ","","3474195540","a.giordan@email.it","I","S","CS",
    " 11049982","13082055","R","PERAZZOLO","DIEGO","M","15031978","SCHIO","VIA A. CANAL 12","36015","SCHIO","VI","27122012","0351","SCHIO ","","3280095234","perazzolo@bmr.it","I","S","CE",
    " 10118325","13082054","R","RIGONI","ANTONIO","M","30071967","THIENE","VIA CORTE MILLEARTE 4","36030","MONTECCHIO PRECALCINO","VI","27122012","0351","SCHIO ","","333-1248514","3331243514@sara-autoricambi.it","I","S","CS",
    " 12001801","13604951","R","TISATO","GIORGIO","M","25021963","THIENE","VIA DON F. FACCIN","36015","SCHIO","VI","27122012","0351","SCHIO ","0445-52317","335-7732671","info@motoclubschio.com","I","S","PR",

IMN logo majestic logo threadwatch logo seochat tools logo