473,396 Members | 2,011 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.

How to specify Date format during LOAD DATA INFILE ?

Will it be possible to specify the date format of type DATE during data
loading ?
Jul 23 '05 #1
8 11109
Ray in HK wrote:
Will it be possible to specify the date format of type DATE during data
loading ?

I don't think it is possible. Why not import the data (maybe with the
date column in some new dummy column) and then reformat the data in the
correct representation using a query on the table?

Jonathan

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #2
Ray in HK wrote:
Will it be possible to specify the date format of type DATE during data
loading ?


"Although MySQL tries to interpret values in several formats, dates
always must be given in year-month-day order (for example, '98-09-04'),
rather than in the month-day-year or day-month-year orders commonly used
elsewhere (for example, '09-04-98', '04-09-98')."

http://dev.mysql.com/doc/mysql/en/da...ime-types.html

Regards,
Bill K.
Jul 23 '05 #3
Thanks, I did read it but just ask if there are any tricks can be played.

"Bill Karwin" <bi**@karwin.com> ¦b¶l¥ó news:d9*********@enews1.newsguy.com
¤¤¼¶¼g...
Ray in HK wrote:
Will it be possible to specify the date format of type DATE during data
loading ?


"Although MySQL tries to interpret values in several formats, dates
always must be given in year-month-day order (for example, '98-09-04'),
rather than in the month-day-year or day-month-year orders commonly used
elsewhere (for example, '09-04-98', '04-09-98')."

http://dev.mysql.com/doc/mysql/en/da...ime-types.html

Regards,
Bill K.

Jul 23 '05 #4
Well , it's because there are quite lots of data and for testing purposes, I
need to re-load the data again and again while the dev machine is
s...l..o...w.
Anyway, thx for your advice. It'd be better if Mysql has such feature as
Oracle that allow the format to be specified during batch data loading.

"Jonathan" <jo******@heelal.nl> ¦b¶l¥ó
news:42**********************@text.nova.planet.nl ¤¤¼¶¼g...
Ray in HK wrote:
Will it be possible to specify the date format of type DATE during data
loading ?

I don't think it is possible. Why not import the data (maybe with the
date column in some new dummy column) and then reformat the data in the
correct representation using a query on the table?

Jonathan

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Jul 23 '05 #5
> "Jonathan" <jo******@heelal.nl> ¦b¶l¥ó
news:42**********************@text.nova.planet.nl ¤¤¼¶¼g...
Ray in HK wrote:
Will it be possible to specify the date format of type DATE during data
loading ?
I don't think it is possible. Why not import the data (maybe with the
date column in some new dummy column) and then reformat the data in the
correct representation using a query on the table?

Jonathan


Ray in HK wrote: Well , it's because there are quite lots of data and for testing purposes, I need to re-load the data again and again while the dev machine is
s...l..o...w.
Anyway, thx for your advice. It'd be better if Mysql has such feature as
Oracle that allow the format to be specified during batch data loading.


I still think as it is for testing that you could once do the import and
then afterwards do a conversion as I suggested.

After you have done this backup the mysql table with the mysqldump tool
or the select into method. This way it is possible for you to restore
earlier status just by restoring your tables from the mysql backup/dump
and you only need to do the conversion of the date once.

Normally importing from a text file is slower than inserting from a dump
file as you can use some tricks which are explained here:

Explanation about the mysqldump utility:
http://dev.mysql.com/doc/mysql/en/mysqldump.html

Information about improving the speed of insert statements:
http://dev.mysql.com/doc/mysql/en/insert-speed.html

I cannot imagine that for testing all data need to be reloaded and
converted all the way from the source again as I think you use the same
set for testing over and over again.

Jonathan

N.B. One word of advice for posting in newsgroups/usenet:
I rearanged our conversation a little bit. For the future please don't
top post as this makes reading conversation more difficult. The most
recent answers in newsgroups are normally posted at the bottom and
redundant information is removed. If you want to answer multiple
questions asked in one message just post your answers in between.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #6
[snip]

N.B. One word of advice for posting in newsgroups/usenet:
I rearanged our conversation a little bit. For the future please don't
top post as this makes reading conversation more difficult. The most
recent answers in newsgroups are normally posted at the bottom and
redundant information is removed. If you want to answer multiple
questions asked in one message just post your answers in between.

My congratulations on the most sensible, user-friendly advice I've ever read
about top-posting. Too often, all one reads is a snarl "Don't top-post"
with the chastiser then going back to something equally effective and
significant, like - tearing up yesterday's newspaper, opening and closing
the refrigerator door 1,234 times on the night of a crescent moon, and
sticking pins in a wax image of next door's ginger tom. I thought your
approach exemplary. May your tribe increase!
Jul 23 '05 #7
>
I still think as it is for testing that you could once do the import and
then afterwards do a conversion as I suggested.

After you have done this backup the mysql table with the mysqldump tool
or the select into method. This way it is possible for you to restore
earlier status just by restoring your tables from the mysql backup/dump
and you only need to do the conversion of the date once.


then the testing will be incomplete.
Jul 23 '05 #8
Ray in HK wrote:
I still think as it is for testing that you could once do the import and
then afterwards do a conversion as I suggested.

After you have done this backup the mysql table with the mysqldump tool
or the select into method. This way it is possible for you to restore
earlier status just by restoring your tables from the mysql backup/dump
and you only need to do the conversion of the date once.

then the testing will be incomplete.

Do you really need to test the whole chain over and over again? I think
testing everything modular would improve your development process and
after you've succesfull tested all steps in the sequence you can do some
over all tests of the whole chain.

Or is our goal to port the data to a new database platform regularly?

Jonathan

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #9

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

Similar topics

2
by: Andreas Emmert | last post by:
Hi there, I'm trying to import a csv file into my MySQL database. Unfortunately the number format for the price column is formatted in German style, i.e. XX,XX (decimals separated by comma not...
14
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 . "\"...
3
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.)...
0
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...
0
by: Karam Chand | last post by:
Hello Is there anyway to change the default date format (possibly in a .ini or .cfg file) from YYYY-MM-DD to another format ? (ie, mm/dd/yyyy or any user-defined format). The useage that I'm...
1
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...
1
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...
9
by: Shapper | last post by:
Hello, I created a dataset from a XML file. One of the dataset fields is . In an ASP:Repeater I am displaying the field. <%# DataBinder.Eval(Container.DataItem, "pubDate", "{0:f}") %> The...
0
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...
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: 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:
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...
0
marktang
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,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.