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

In reply to Re: DBD: bind_column behviour with multiple "unnamed" columns by Grygonos
in thread DBD: bind_column behviour with multiple "unnamed" columns by olivierp

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.