Skip to main content
tclaremont
Inspiring
August 21, 2008
Question

Flummoxed by a query

  • August 21, 2008
  • 4 replies
  • 588 views
This is a new one for me. I have been querying the same database for years. I have hundreds of queries working on this very database on a daily basis without issues. Today a new request came in to access a field that I have not needed to retrieve before.

Mcaidrecda (Medicaid Recertification Date) is a field in the BasicInfo table, which is part of a FoxPro database designed by a vendor.

The following query completes just fine:

SELECT *
FROM BasicInfo
WHERE IDNo = '5183'

And yes, I know that the use of asterisks in a query is not good practice. I am trying to troubleshoot here...

I do a CFDUMP of the query, and the field I am most interested in, namely BasicInfo.MCAIDRECDA, shows up as expected in the CFDUMP, along with all of the other fields in the table.

HOWEVER,

When I rewrite the query as follows:

SELECT IDNo, Mcaidrecda
FROM BasicInfo
WHERE IDNo = '5183'

I get an error saying that Column 'MCAIDRECDA' is not found. It happens when I remove the WHERE clause, too.

When I open the database table (a FoxPro table), the Mcaidrecda field is very clearly there, and this is supported by the first test (CFDUMP) shown above. Why can't it see the field when the query is written the second way??? I checked and triple checked my spelling of the field names, etc, and all is well.

The reason this is important is because I want to set a WHERE clause based on the Mcaidrecda field, but it stops cold and says the field does not exist, even though I have proven time and again that it is most certainly there.

SOMEBODY tell me I am missing the obvious here....

BTW: CF7
    This topic has been closed for replies.

    4 replies

    tclaremont
    Inspiring
    August 21, 2008
    Phil, I definately thought of that. I went so far as to open the original table in foxpro and then Copy/Paste the field name to ensure that I had it right.

    I even had some other staff members look at the code with a fresh set of eyes and cant see the issue.

    The fact that a CFDUMP of a SELECT * statement shows the field is really throwing me....
    Inspiring
    August 21, 2008
    If you run the query in foxpro does it work?
    tclaremont
    Inspiring
    August 21, 2008
    I dont think it is a caching issue. I have gone so far as to set the cache attributes in the query statement with no effect.

    I have proven via other queries that FP is not case sensitive. I have also gone to the actual FoxPro table and copied and pasted the field name into my query statement just in case my eyes were not working today.

    Therefore, gremlins are the only real answer!
    Participating Frequently
    August 21, 2008
    Is this the only column that is giving you the problem? Could it be possible that the vendor included leading/traling space(s) or some other "whitespace" character(s) in the name when they created the column?

    Phil
    Inspiring
    August 21, 2008
    couple of ideas off the top of my head (have not worked with FP on the
    back end, so no definite answers):

    a) query/template caching?
    b) case sensitivity for field names?
    c) gremlins?

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/