473,396 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MySql Load Utility Questions

When using the load utility on a CSV file, it seems I always need to
edit the input file and add an extra comma after the last field in
order for MySql to parse the line properly.

I use a command like:

LOAD DATA INFILE 'absolute path to file.csv'
IGNORE
INTO TABLE table-name
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED
BY '\n' ;

for an input file created on a Linux system and I always have to add
the extra comma to the end of each record in order to get the records
loaded correctly.

Does anyone have some experience with this and can provide some
suggestion?

Also, is it possible to use the mative MySql load utility to load a
fixed-format input file? From everything I am reading it seems you
have to use some other language like perl or python or php, etc in
order to load a fixed-format file.

Any help is welcome.

Thanks
Jul 20 '05 #1
2 1365
On 18 Aug 2004 18:21:03 -0700, in mailing.database.mysql
ri***@csmarketing.net (Rick) wrote:
| When using the load utility on a CSV file, it seems I always need to
| edit the input file and add an extra comma after the last field in
| order for MySql to parse the line properly.
|
| I use a command like:
|
| LOAD DATA INFILE 'absolute path to file.csv'
| IGNORE
| INTO TABLE table-name
| FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED
| BY '\n' ;
|
| for an input file created on a Linux system and I always have to add
| the extra comma to the end of each record in order to get the records
| loaded correctly.
|
| Does anyone have some experience with this and can provide some
| suggestion?
This sounds like an extra field has been added to the table but not
included within the csv file.

When I need to import data I
send the csv data to a temp table
use as many queries as needed to reformat/check the data
move the data into the appropriate table(s)
delete the temp table data
| Also, is it possible to use the mative MySql load utility to load a
| fixed-format input file? From everything I am reading it seems you
| have to use some other language like perl or python or php, etc in
| order to load a fixed-format file.
|
| Any help is welcome.
|
| Thanks


---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 20 '05 #2
Thanks for the feedback. From what I understand, MySql will ignore any
extra data in the csv file, but if there is not enough data in the csv
file to match the table, you need to include the column names on the
load utility.

Have you ever been able to get MySql native load utility to load a
fixed-format flat file?

Thanks
-Rick
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rick | last post by:
When using the load utility on a CSV file, it seems I always need to edit the input file and add an extra comma after the last field in order for MySql to parse the line properly. I use a...
175
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
3
by: claus.hirth | last post by:
When I execute the following statment using the Command Center it works: LOAD CLIENT FROM 'Y:\\TheFixedWidthData.txt' OF ASC METHOD L ( 1 1,2 11,12 17) REPLACE INTO S00.TheTargetTable...
1
by: Karuna | last post by:
Hi, I am new to MySQL. I want to create a script file which will include a number of commands and execute it, just like we do in Oracle. Can any one tell me how to do it? Suppose I want to create...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
1
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was...
7
by: Bob Stearns | last post by:
Is there an option in php to do a 'require xxx.php' if, when a function call to xxx is encountered, it is not defined? It would look in all the standard places.
1
by: huyuhui | last post by:
The following is a question of LOAD utility. Question: How does the DB2 enforce table check constraints for data added to table with the LOAD utility? A. With the BUILD phase of LOAD B. With the...
5
by: Ted | last post by:
I am working on two versions of an application, one of which will be a windows forms application (which will need to be redistributable) and the other will be a web application. I have MS Visual...
5
by: Marijn | last post by:
Hello everybody, I am new to PHP and working on extending my knowledge of OOP. The posts in this group concerned with whether or not to use an OO approach when programming in PHP is not what I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.