Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
Hi all,
I've created a website the is using SQL 2000/SQL2005 as the back end and I've been tasked to take the catalog I've build for the website and allow it to be ran on a CD. So With the CD version of the website I'm using a Access 2003 database, but for some reason my T-SQL queries wont work with Access. I have a bit field in my SQL database that I use as an Active flag. Access use a "Yes/No" field for this and I'm not sure why the query isn't working. I did notice that Access uses -1/0 and not 1/0, so I changed my query to reflect this:

<br />SELECT     * <br />FROM tblWeb_E_Catalog_Categories <br />WHERE (Active) = -1) <br />



Is there any reason why this wouldn't work?
Posted

I see two closing parenthesis )) and only 1 open parenthesis. (
 
Share this answer
 
Hi,

... WHERE NOT (Active = 0) might work for both database systems.

:)

 
Share this answer
 

"I have a bit field in my SQL database " what is the data type exacrly?  As you pointed out -1 is YES/TRUE in ACCESS and 0 is NO/FALSE.

You may be getting a zero due to type conversions.  Have you tried to display the ACTIVE value with debug.print in your interactive window.

Can you use a Boolean type instead taht may be a better fit?

You should correct the bracket issue as well.  I am surprised this does not generate a syntax error already.

Hope this helps.

 
Share this answer
 
v2


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900