I've got a comma delimited txt file that goes like this:
1,3,6,3,,5,3,1
2,3,4,3,3,5,3,1
Sometimes there are empty values that just show a double comma: ",,".
So, when I use this command.... - load data infile 'C:/test.txt'
-
into table MyTable
-
fields terminated by ','
-
lines terminated by '\n'
-
(a, b, c, d, e, f, g, h);
... I get an error, since the datatypes are INT. MySQL interprets the "nothing" in-between the commas to be a string.
Can anybody help me?
1 1149
I've got a comma delimited txt file that goes like this:
1,3,6,3,,5,3,1
2,3,4,3,3,5,3,1
Sometimes there are empty values that just show a double comma: ",,".
So, when I use this command.... - load data infile 'C:/test.txt'
-
into table MyTable
-
fields terminated by ','
-
lines terminated by '\n'
-
(a, b, c, d, e, f, g, h);
... I get an error, since the datatypes are INT. MySQL interprets the "nothing" in-between the commas to be a string.
Can anybody help me?
What was the exact error message you got?
reference[/url]] An empty field value is interpreted differently than if the field value is missing: - For string types, the column is set to the empty string.
- For numeric types, the column is set to 0.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bruce A. Julseth |
last post by:
When I execute this SQL statement in my PHP code, I get an error
"File '.\Address.txt' not found (Errcode: 2)"
$File = addslashes(".\Address.txt");
$SQL = "Load Data InFile \"" . $File . "\"...
|
by: Otto |
last post by:
Hello to all
I have a problem how to write correctly a PHP string.
I did the following import with the help of PHPMyAdmin:
Nombre d'enregistrements insérés : 364 (traitement: 0.0553
sec.)...
|
by: hall |
last post by:
I have a problem with my design of a templatized class. I'm trying to
figure out how to load and save the data inside it, but can't. My class
looks like this
------------------------------------...
|
by: Montagna, Dan |
last post by:
------_=_NextPart_001_01C35B55.62B4A6E0
Content-Type: text/plain;
charset="iso-8859-1"
Hello,
I'm a very new mysql/php user and am trying to use the load data infile
command without luck. I'd...
|
by: Donald Tyler |
last post by:
Then the only way you can do it that I can think of is to write a PHP script
to do basically what PHPMyAdmin is trying to do but without the LOCAL in
there.
However to do that you would need to...
|
by: Jami Bradley |
last post by:
HI all,
For the past several months we have been using LOAD DATA LOCAL INFILE to bulk load tables within
Perl modules.
Recently, someone thought it would be a good idea to upgrade the Solaris...
|
by: Ray in HK |
last post by:
What are the differences between LOAD DATA INFILE and LOAD DATA LOCAL INFILE
?
I found some web hosting company do not allow using LOAD DATA INFILE but
allow LOAD DATA LOCAL INFILE. The reason...
|
by: nsh |
last post by:
mailing.database.mysql, comp.lang.php
subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING!
version info:
my isp is running my web page on a linux box with php ver. 4.4.1
according to...
|
by: lanesbalik |
last post by:
hi all,
right now i'm trying to migrate from db2 running under linux to mysql v5.1.
i manage to export out the db2 structure & data into a del (ascii) file.
but when i try to load the data...
|
by: Megi |
last post by:
welcome,
I input data form file to mysql with command: load data local infile..
The efect is that the data are duplicated or trippled..etc with every re-loading the script, but I need to load...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |