Hi All,
  I have a database where I need to update a load of tables that have a column named 'date' with values such as 11:11:2007, 12:11:2007, etc, to a universal integer value such as 20071111, 20071112, etc. I'm trying to figure out what the quickest and most efficient way to do this, as the database is BIG (in fact there are several versions of the database and some of them are very big).
  I've got code that increments the old date style, and have the first date for each table, so I can easily make a loop that starts at 01:01:2007 and increments each time until it gets to the current date.
  Something like:-
until ($date eq $today) { $dbh->do("update table set date=20070101 where date='01:01:2007'") +; $date = nextdate($date); }

Is going to take forever, and probably time out through CGI (to long a story as to why it would be called as CGI).
Help greatly appreciated

Lyle

Thanks to everyone, your replies have been most helpful

In reply to Perl and MySQL update question by cosmicperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.