Hello,

I have a coupla questions about getting data from an access database. I can successfully connect to the base, issue queries, and get results. But some thing don't work out at all:

The database I'm querying holds about 2000 records. A "select *" query returns only a handfull of them (27 or 28 to be precise). The problems apparently stems from the fact that some field names contain a space (ie "QUANTITE DISPONIBLE") or a dash. If I initiate a query on a single column whose name does not contain any spaces or dashes then I get my 2000 or so records. Otherwise, the query does not return anything.

Backticking column names don't help at all. In fact, the query doesn't even bother to execute. Enclosing said names in square brackets does not help either.

That was the first note.

The second one is this:

Say I'm using two "trouble-free" fields name: REF and DESC.

The execution of the query "select ref, desc from my_table" returns all rows. But the query "select desc from my_table order by ref" does strictly nothing!

Also, can an illegal character of some kind screw up the fetching process?

Can some of you monks enlighten me 'cause I'm in the dark here.

Oh, I'm on linux, all cpan packages are up-to-date, unixodbc installed and properly configured, mdbtools installed.


In reply to Fetching data from Access using DBI by hacheb

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.