Mysql updating dates in a table

Craig White craigwhite at azapple.com
Tue Aug 4 16:15:10 MST 2009


On Tue, 2009-08-04 at 15:46 -0700, Eric Cope wrote:
> how many tables?
> 
> On Tue, Aug 4, 2009 at 3:44 PM, Craig White <craigwhite at azapple.com>
> wrote:
>         I need to update almost all (but not quite all) records in a
>         data table
>         because the dates were imported like '08/04/09' instead of
>         '2009-08-04'
>         
>         I am looking at the mysql reference manual but it doesn't
>         appear that it
>         would be easy to script a line by line 'update' from a csv
>         file.
>         
>         Now I still have the csv files (and a copy with the dates
>         fixed) and I
>         suppose I could 'find', 'delete' and then 'import' again but
>         there are
>         relational records so mysql would probably prevent me from
>         doing that
>         unless I suspend all relational checks when I delete those
>         records prior
>         to reimporting them with the fixed dates.
>         
>         What's the best way to accomplish this?
----
one table (salesorders and at least one related table
(salesorderdetails) which as you might suspect is the line items table
for salesorders.

I need to keep the orders from 8/1/2009 through 8/4/2009 and fix the
rest but the rest have to be either deleted and imported again (probably
best) or simply updated from another file (which I have in CSV format
and the dates are fixed properly).

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the PLUG-discuss mailing list