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

Ok, I can get rid of the code that isn't going to be used, but I just need to see every row "ID" in this table updated with numbers incremented like: for every row the first would have 0 and second row 1 and so forth...

Replies are listed 'Best First'.
Re^5: Increment DB using Perl
by jZed (Prior) on Mar 08, 2005 at 16:46 UTC
    Well the UPDATE statement is scoped to UPDATE all rows, each time through the loop. You need a WHERE clause on it. But I still don't understand what the $pointer loop has to do with the update loop. Which rows are you trying to update? What belongs in the WHERE clause?
      Just the row "ID", nothing else, just need the code to run and insert numbers starting from 0 to whatever is the last row in the table from the database.
        Now you've really lost me. Which rows do you want to update? What should the XXX in this be?: UPDATE request SET ID=$newid WHERE XXX