in reply to DBD::ODBC won't read past a certain record

There are two (related) things that I see that could be happening, not knowing your table description :

How do you know how many rows are there in your database? Did you run SELECT COUNT(*) FROM Transaction ? This would be the only sure way to know how many rows there are in your table.

How do you know that there are no duplicate IDs? Your script finishes the loop after it has retrieved the first row for a given ID without throwing an error if there are more rows to be retrieved. You should check your column restrictions, add the check to your program, and run some SQL to check that each ID is unique (which is too early in the morning for me to come up with, but someone will surely correct me):

SELECT DISTINCT a.ID,b.ID FROM Transactions as a,Transactions as b whe +re a.ID = b.ID

Caveat: Please do not try this command in the production directly, because we at Cartesian Products take our business seriously (or so I fear). I think this command will chew up some serious memory.

Also, did you check what your maximum ID is?

SELECT max(ID) FROM Transactions

Nothing of this should apply if your column definition for ID defines PRIMARY KEY, unless you used some bulk loader command or other external means to initialize your database.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Replies are listed 'Best First'.
Re: DBD::ODBC won't read past a certain record
by Groll (Acolyte) on Aug 06, 2003 at 04:09 UTC
    Thanks for your input, but I wrote this in a bit of a hurry, and perhaps didn't write all the information I had. The TransactionID is a primary key, and I can see all the record via both Access and the SQL Server Enterprise Manager. As i said, I know there are well in excess of 1 million records.
    The stinger is that I wrote the equivalent code using Win32::ODBC and got the same results.