in reply to DBD: bind_column behviour with multiple "unnamed" columns

edit: <unprofessional answer>after re-reading I see you fixed it... but anyhow.. here's my best guess as to what's happening. I'm betting fetch is seeing two fields named the same thing and only returning the last instance. For instance, fetch might say.. how many field names do we have? 2.. ok...and since field3 was named "un-named" last, we'll return its value for all fields named "un-named". SQL Server has no problem having two fields aliased to the same name, so I'm guessing its something in the behavior of $sth->fetchrow_arrayref() that's to blame. </unprofessional answer> gmax said exactly what I was trying to say, but aparently I couldn't make my brain function this morning. DBD driver not interacting properly. Check your version of DBD:ODBC maybe?

Try this instead

my $sql =<<'EOFSQL'; SELECT LOWER(field_one) AS field_one, field_two, UPPER(field_three) AS field_three FROM sample_table (NOLOCK) WHERE field_one = ? EOFSQL
Just alias the column names to be unique. That should correct the problem. Not a Perl problem though, actually a SQL problem.


Grygonos