Re: Mysql updating dates in a table

2009-08-05 Thread Alex Dean
On Aug 4, 2009, at 5:44 PM, Craig White 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

Re: Mysql updating dates in a table

2009-08-04 Thread Craig White
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 creat

Re: Mysql updating dates in a table

2009-08-04 Thread JD Austin
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 afte

Re: Mysql updating dates in a table

2009-08-04 Thread Craig White
On Tue, 2009-08-04 at 16:21 -0700, JD Austin wrote: > http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html > You can use Str_to_date to convert it to a date. > Date/timestamp data should be one of the date types (Datetime, date, > timestamp). > I'd do it like this (all sql and won't

Re: Mysql updating dates in a table

2009-08-04 Thread JD Austin
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html* You can use Str_to_date to convert it to a date. *Date*/*timestamp data should be* *one of the date types (Datetime, date, timestamp). I'd do it like this (all sql and won't lose data): 1. Add a column to the table that is dat

Re: Mysql updating dates in a table

2009-08-04 Thread Craig White
On Tue, 2009-08-04 at 16:05 -0700, Austin William Wright wrote: > Craig White 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 does

Re: Mysql updating dates in a table

2009-08-04 Thread Craig White
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 > 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 >

Re: Mysql updating dates in a table

2009-08-04 Thread Austin William Wright
Austin William Wright wrote: > [...] > Replace all instances of tablename and columnname with the targets, and > change DATE NOT NULL as necessary. That should work. Whoops, Thunderbird formatted my fonts for me, ignore the pipes (wysiwyg fail): ALTER TABLE `tablename` CHANGE `columnname` `columnna

Re: Mysql updating dates in a table

2009-08-04 Thread Austin William Wright
Craig White 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

Re: Mysql updating dates in a table

2009-08-04 Thread Eric Cope
how many tables? On Tue, Aug 4, 2009 at 3:44 PM, Craig White 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 > w

Mysql updating dates in a table

2009-08-04 Thread Craig White
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 hav