in reply to Re^2: Increment DB using Perl
in thread Increment DB using Perl

The problem is not with code, but the SQL.

You're setting the ID to $new_id for EVERY row. That means you're only seeing the last result.
--------------
It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs

Replies are listed 'Best First'.
Re^4: Increment DB using Perl
by Anonymous Monk on Mar 08, 2005 at 16:45 UTC
    And how would I fix that? To get 0 on the first row, 1 on the second and so forth?
      You need a static ID. If you want to go based on the ordering of the select statement, try (not sure how many DB's support this):

      SELECT ROWID, ID FROM REQUEST


      and then update based upon that rowid (if possible)... but it's tricky when there's no key to go off of. I'm not even 100% sure that'll work.
      --------------
      It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs