jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:
I have an application that imports a CSV file into a MySQL table where all fields are varchar type. One field has a date in the format 'MM/DD/CCYY hh:mm' where leading zeroes are typically not present. This needs to be converted to something that MySQL will swallow - such as: 'CCYY-MM-DD hh:mm:ss' where all zeroes are required.
I can get the various parts of the time using split and then rebuilding the string. BUT there are typically somewhere between 7000 and 500000 records in the table.
I am assuming that doing a SELECT and getting the key and the date as text field into a HASH - then convert the date format - the do an UPDATE will be the best way of doing the change?
App is in Perl 5.8.0 using DBI/DBD-MySQL.
Your advice is sought on
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Convert date format in database table.
by runrig (Abbot) on Oct 07, 2003 at 03:47 UTC | |
by cLive ;-) (Prior) on Oct 07, 2003 at 06:13 UTC | |
by tachyon (Chancellor) on Oct 07, 2003 at 06:18 UTC | |
by cLive ;-) (Prior) on Oct 07, 2003 at 06:23 UTC | |
by tachyon (Chancellor) on Oct 07, 2003 at 12:11 UTC | |
by runrig (Abbot) on Oct 09, 2003 at 01:57 UTC | |
|
Re: Convert date format in database table.
by Zaxo (Archbishop) on Oct 07, 2003 at 04:00 UTC | |
|
Re: Convert date format in database table.
by tachyon (Chancellor) on Oct 07, 2003 at 03:55 UTC | |
|
Re: Convert date format in database table.
by jeffa (Bishop) on Oct 07, 2003 at 12:41 UTC |