Mysql updating dates in a table

Craig White craigwhite at azapple.com
Tue Aug 4 17:09:32 MST 2009


On Tue, 2009-08-04 at 16:41 -0700, JD Austin wrote:
> If the current column was a date type there had to be a ton of
> failures!
> If you have unique values in the data you can just craft update
> statements from the csv file. Use excel/OO Calc, perl, etc to parse
> apart the original file to create update table statements that you can
> pipe back to mysql after you test a few.
----
OK, well, just to be clear...

the orderdate column is indeed a date and for example, an imported
column like '10/12/06' imported as 2010-12-06 instead of 2006-12-06 and
apparently any of the dates it couldn't make sense of were given the
'default' value of '0000-00-00' so there weren't any failures at all.

I think I see what you mean now about using OOo to craft update
statements...

AC2 ="UPDATE salesorders SET orderdate = '"&$N$2&"' WHERE orderno \
= '"&$A$2&;'"
AC3 ="UPDATE salesorders SET orderdate = "'&$N$2&'" WHERE orderno \
= '"&$A$2&;'"

and then just paste special (text only) into a word processor and save
it so I just run,

mysql my_database < mysql-update.sql

I think that's got to be close...

thanks

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