Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 ado, access, sql server SELECT statement

Author  Topic 

MikeB
Constraint Violating Yak Guru

387 Posts

Posted - 2001-12-06 : 10:50:57
I am trying to create a select statement where one of the comparisons is to a field that can be true/false in access. I would also like to know how to do this for SQL Server if possible.

Here is the SELECT statement I tried:
csQuery.Format("SELECT DISTINCT component_id FROM Component_Info_Tbl WHERE project_id = '%s' AND component_name = '%s' AND component_in_pour = false", csProjectID, csType);

I also tried
component_in_pour = 0

Any help?
The error being returned is:
Description: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.The thread 0xF5 has exited with code 0 (0x0).

Thanks
Mike B


AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-12-06 : 12:31:53
Well, your error message Too few parameters doesn't sound like it's an error in the syntax of your SELECT statement, but rather an error in your ODBC Connection String, or something like that.

To test the syntax, I created a dummy table and built a query that reads:

SELECT Test.*
FROM Test
WHERE (((Test.ActiveFlag)=True));

And this properly returned the rows where the Yes/No field was Yes. Access can be picky about parentheses, but again, based on your error message, I don't think that's the problem.

As for SQL, there is no Boolean (Yes/No, True/False) data type. The closest thing is a Bit field which can have the values Null, 0, or 1. (You can also use TinyInt which allows for values 0-255 if you need more).

-------------------
It's a SQL thing...
Go to Top of Page

MikeB
Constraint Violating Yak Guru

387 Posts

Posted - 2001-12-06 : 17:19:39
The problem was wrong table name :(. Thanks for the reply!
Mike B

Go to Top of Page
   

- Advertisement -