MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 8th, 2013, 10:18 AM
giovannino giovannino is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 giovannino User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 3 sec
Reputation 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 ??

Reply With Quote
  #2  
Old January 10th, 2013, 04:18 AM
sr sr is offline
Problem Solver
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2001
Location: Stockholm, Sweden
Posts: 4,424 sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level)sr User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 6 h 40 m 46 sec
Reputation Power: 532
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

Reply With Quote
  #3  
Old January 10th, 2013, 04:26 AM
giovannino giovannino is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 giovannino User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 3 sec
Reputation 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",

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Mystery about 2 identical CSV files

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap