Bit Column In A Query Where Clause

G

g11DB

The Query inside my MS Access database looks like the following:


Code:
SELECT
dbo_MyTab1.MyCol4, dbo_MyTab2.MyCol3
FROM
dbo_MyTab2 INNER JOIN dbo_MyTab1
ON dbo_MyTab2.MyCol2 = dbo_MyTab1.MyCol2
WHERE
(((dbo_MyTab1.MyCol1)=0)
AND dbo_MyTab1.MyCol3 NOT LIKE '%Expr%')
AND ((dbo_MyTab2.MyCol4)=False)));

Given that in the backend database (sql server 2005):

Code:
MyTab1.MyCol1 is (bit, not null)
MyTab2.MyCol4 is (Flag(bit), not null)
The problem is that when I execute the query, it prompts a dialog box asking for the value of MyTab1.MyCol1.
There should be none of this dialog pop-up. Anyone encountered this before?

Hope this helps make the problem clearer?
 
S

Stefan Hoffmann

hi,
SELECT
dbo_MyTab1.MyCol4, dbo_MyTab2.MyCol3
FROM
dbo_MyTab2 INNER JOIN dbo_MyTab1
ON dbo_MyTab2.MyCol2 = dbo_MyTab1.MyCol2
WHERE
(((dbo_MyTab1.MyCol1)=0)
AND dbo_MyTab1.MyCol3 NOT LIKE '%Expr%')
AND ((dbo_MyTab2.MyCol4)=False)));
The problem is that when I execute the query, it prompts a dialog box asking for the value of MyTab1.MyCol1.
There should be none of this dialog pop-up. Anyone encountered this before?
Sounds like a naming problem, as you see you linked tables are prefixed
with "dbo_", where the pop-up requests a value for "MyTab1.MyCol1"
without that prefix.


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,
Code:
AND ((dbo_MyTab2.MyCol4)=False)));

Given that in the backend database (sql server 2005):
Code:
MyTab1.MyCol1 is (bit, not null)
MyTab2.MyCol4 is (Flag(bit), not null)
There may also arise some problem with representation of BIT columns,
you should change your comparison to

dbo_MyTab2.MyCol4 = 0

for False and

dbo_MyTab2.MyCol4 = 1

for True.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top