<p>I have a remote DB2 database that I'm accessing through ODBC. When I have a query like</p>

<pre><code>SELECT t.foo, t.bar, t.problemcolumn
FROM problemtable t
WHERE t.bar &lt; 60;
</code></pre>

<p>it works like a charm, so the table and columns obviously exist.</p>

<p>But if I specify the problem column in the WHERE clause</p>

<pre><code>SELECT t.foo, t.bar, t.problemcolumn
FROM problemtable t
WHERE t.problemcolumn = 'x'
AND t.bar &lt; 60;
</code></pre>

<p>it gives me an error </p>

<pre><code>Table "problemtable" does not exist.
</code></pre>

<p>What could possibly be the reason for this? I've double checked the spellings and I can trigger the problem just by including the problemcolumn in the where-clause.</p>

[{'answer_id': 82070, 'author': 'Per Hornshøj-Schierbeck', 'author_id': 11619, 'author_profile': 'https://Stackoverflow.com/users/11619', 'pm_score': 2, 'selected': False, 'text': "<p>Sorry for the obvious answer, but does the problemtable exist? Your code looks like pseudo code because of the table/column names, but be sure to double check your spelling. It's not a view which might even consist of joined tables across different databases/servers?</p>\n"}, {'answer_id': 82194, 'author': 'bastos.sergio', 'author_id': 12772, 'author_profile': 'https://Stackoverflow.com/users/12772', 'pm_score': 2, 'selected': False, 'text': "<p>What is the actual SQL you're using?  I don't see anything wrong with the example you put up.  Try looking for misplaced commas and/or quotes that could be triggering the error.</p>\n"}, {'answer_id': 82283, 'author': 'Swati', 'author_id': 12682, 'author_profile': 'https://Stackoverflow.com/users/12682', 'pm_score': 0, 'selected': False, 'text': "<p>Does it work with just:</p>\n\n<pre><code>SELECT t.foo, t.bar, t.problemcolumn\nFROM problemtable t\nWHERE t.problemcolumn = 'x'\n</code></pre>\n"}, {'answer_id': 93478, 'author': 'boes', 'author_id': 17746, 'author_profile': 'https://Stackoverflow.com/users/17746', 'pm_score': 0, 'selected': False, 'text': "<p>Please run the next SQL statements. For me it works fine. If you still have this strange error, it will be a DB2 bug. I had some problems once with copying code from UNIX editors into Windows and vice versa. The SQL would not run, although it looked ok. Retyping the statement fixed my problem then.</p>\n\n<p>create table problemtable (\n    foo varchar(10),\n    bar int,\n    problemcolumn varchar(10) \n);</p>\n\n<p>SELECT t.foo, t.bar, t.problemcolumn \n    FROM problemtable t\n    WHERE t.bar &lt; 60;</p>\n\n<p>SELECT t.foo, t.bar, t.problemcolumn\n    FROM problemtable t\n    WHERE t.problemcolumn = 'x'\n    AND t.bar &lt; 60;</p>\n"}, {'answer_id': 163333, 'author': 'Fuangwith S.', 'author_id': 24550, 'author_profile': 'https://Stackoverflow.com/users/24550', 'pm_score': 0, 'selected': False, 'text': '<p>It think it should be work in DB2.\nWhat is your font-ent software?</p>\n'}, {'answer_id': 1107682, 'author': 'SO User', 'author_id': 39289, 'author_profile': 'https://Stackoverflow.com/users/39289', 'pm_score': 0, 'selected': False, 'text': '<p>DB2 sometimes gives misleading errors. You can try these troubleshooting steps:</p>\n\n<ol>\n<li>Try executing the code through\nDBArtisan or DB2 Control Center and\nsee if you get a proper result/ error\nmessage.</li>\n<li>Try using schema_name.problemtable\ninstead of just problemtable</li>\n<li>Make sure that problemcolumn is of\nthe same data type that you are\ncomparing it with.</li>\n</ol>\n'}]
['https://Stackoverflow.com/questions/82003', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2087/']