Cast to Boolean

  • Thread starter Thread starter Darren
  • Start date Start date
D

Darren

How can I run a Into query that contains a boolean field.
The field is always interpreted as an integer field?

ex:
Select TableA.*, false as testbool into testTable from TableA

Thanks
 
Create the table the way you want it.
Then use an Append query to add the records.

Perhaps you might be better of without the boolean field anyway, as JET has
some problems with yes/no data type. Details in:
Why I stopped using Yes/No fields
at:
http://allenbrowne.com/NoYesNo.html
 
Both valid, but doesn't answer my question.
Even though 0,-1 represent boolean values, it doesn't change the fact that
the field is integer and I need it to be of type boolean (YesNo)

I am currently doing 2 steps to get to this, but there must be a way to do
it in one step.

Thanks
 
Why reply if you don't have an answer?
I am aware of my options, but I am dealing with compatability issues.
 
Perhaps you might be better of without the boolean field anyway,
as JET has some problems with yes/no data type. Details in:
Why I stopped using Yes/No fields
at:
http://allenbrowne.com/NoYesNo.html

Allen, your example of the outer join bug makes no sense. You have a
join between company and employee and group on CompanyID, which is
available in your Employee table. Thus, you don't need to have a
join at all. Your example should group on the Company field instead
to make any sense.

Of course, I don't see the point of the outer join at all, except to
produce a list of all companies with the counts for invited/not
invited. But that makes no sense, as you could have people with no
company who are invited (i.e., self-employed).

And you're asking Jet to summarize Null fields *if* there are no
employees for a particular company. But if there aren't, then, well,
why include them in the resultset at all?

In other words, I think your example is artificially constructed to
produce an error. I've in all my years never encountered this
problem and I use just this kind of structure all the time,
including the Boolean fields.
 
Thanks for your comments, David.

Your comment that the example is articially constucted to produce the error
is accurate. That's exactly what is does. The real case scenarios are
considerably more involved. The case I've been working on this year involves
testing, where a result can be pass or fail or not-yet-known. Hopefully it's
fairly easy to see where an outer join with tests where the test result is
not yet returned produces Null in a yes/no field.

Anyway, if you are aware of the issue, it may at least help identify what's
going on if you do strike this one day.
 

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

Back
Top