PC Review


Reply
Thread Tools Rate Thread

-1 and 0 for "Yes" and "No" (?)

 
 
croy
Guest
Posts: n/a
 
      11th May 2011
It seems with MS Access that it is understood that -1
corresponds with "Yes", and 0 corresponds with "No".

Is that generally true for the database design community as
a whole?

--
croy
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      11th May 2011
On Wed, 11 May 2011 08:11:43 -0700, croy <(E-Mail Removed)> wrote:

>It seems with MS Access that it is understood that -1
>corresponds with "Yes", and 0 corresponds with "No".
>
>Is that generally true for the database design community as
>a whole?


No. Not even Microsoft is consistant; in SQL/Server a Boolean field is stored
as a Bit, with +1 being TRUE and 0 being FALSE.

I think it's safe now to assert that 0 is FALSE and nonzero is TRUE, but do
read the documentation carefully!
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
 
David-W-Fenton
Guest
Posts: n/a
 
      12th May 2011
John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in
news:(E-Mail Removed):

> On Wed, 11 May 2011 08:11:43 -0700, croy <(E-Mail Removed)> wrote:
>
>>It seems with MS Access that it is understood that -1
>>corresponds with "Yes", and 0 corresponds with "No".
>>
>>Is that generally true for the database design community as
>>a whole?

>
> No. Not even Microsoft is consistant; in SQL/Server a Boolean
> field is stored as a Bit, with +1 being TRUE and 0 being FALSE.
>
> I think it's safe now to assert that 0 is FALSE and nonzero is
> TRUE, but do read the documentation carefully!


If you program on that assumption, your code will be very
cross-compatible with all databases, seems to me. True is really
nothing more than NOT FALSE.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
Gene Wirchenko
Guest
Posts: n/a
 
      18th May 2011
On 12 May 2011 00:25:29 GMT, "David-W-Fenton"
<(E-Mail Removed)> wrote:

>John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in
>news:(E-Mail Removed):
>
>> On Wed, 11 May 2011 08:11:43 -0700, croy <(E-Mail Removed)> wrote:
>>
>>>It seems with MS Access that it is understood that -1
>>>corresponds with "Yes", and 0 corresponds with "No".
>>>
>>>Is that generally true for the database design community as
>>>a whole?

>>
>> No. Not even Microsoft is consistant; in SQL/Server a Boolean
>> field is stored as a Bit, with +1 being TRUE and 0 being FALSE.
>>
>> I think it's safe now to assert that 0 is FALSE and nonzero is
>> TRUE, but do read the documentation carefully!

>
>If you program on that assumption, your code will be very
>cross-compatible with all databases, seems to me. True is really
>nothing more than NOT FALSE.


It is a dangerous assumption. NOT can be a bitwise operator on
integers. In two's-complement arithmetic, NOT 1 equals -2, and both
are considered true by the non-zero is true assumption.

If this is a concern, use a boolean type. If you can not do
that, then determine true and false using something like
true=0=0
false=not true
and then use those variable where you need boolean values.

Sincerely,

Gene Wirchenko
 
Reply With Quote
 
David-W-Fenton
Guest
Posts: n/a
 
      21st May 2011
Gene Wirchenko <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> On 12 May 2011 00:25:29 GMT, "David-W-Fenton"
><(E-Mail Removed)> wrote:
>
>>John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in
>>news:(E-Mail Removed):
>>
>>> On Wed, 11 May 2011 08:11:43 -0700, croy <(E-Mail Removed)>
>>> wrote:
>>>
>>>>It seems with MS Access that it is understood that -1
>>>>corresponds with "Yes", and 0 corresponds with "No".
>>>>
>>>>Is that generally true for the database design community as
>>>>a whole?
>>>
>>> No. Not even Microsoft is consistant; in SQL/Server a Boolean
>>> field is stored as a Bit, with +1 being TRUE and 0 being FALSE.
>>>
>>> I think it's safe now to assert that 0 is FALSE and nonzero is
>>> TRUE, but do read the documentation carefully!

>>
>>If you program on that assumption, your code will be very
>>cross-compatible with all databases, seems to me. True is really
>>nothing more than NOT FALSE.

>
> It is a dangerous assumption. NOT can be a bitwise operator
> on
> integers.


But it's not in VBA, which is what you'd be using in Access.

Of course, it's certainly true that you could be using it in SQL, as
well, but if you're not writing passthroughs, it will be executed by
Jet/ACE, so results will be reliable.

> In two's-complement arithmetic, NOT 1 equals -2, and both
> are considered true by the non-zero is true assumption.
>
> If this is a concern, use a boolean type. If you can not do
> that, then determine true and false using something like
> true=0=0
> false=not true
> and then use those variable where you need boolean values.


I don't think any of this is relevant to any circumstances in which
one would be using Access as one's development platform.

That WAS what we were talking about, no?

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
Gene Wirchenko
Guest
Posts: n/a
 
      21st Jun 2011
On 21 May 2011 19:37:22 GMT, "David-W-Fenton"
<(E-Mail Removed)> wrote:

[snip]

>I don't think any of this is relevant to any circumstances in which
>one would be using Access as one's development platform.
>
>That WAS what we were talking about, no?


No. OP asked "Is that generally true for the database design
community as a whole?"

Sincerely,

Gene Wirchenko
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
ReVIEW (Erratum): some shortcut keys not working anymore-----help""""""""PhpApach...WORK WELL!!!! wbrowse@gmail.com Windows XP Help 0 13th Apr 2007 12:29 PM
<FORM METHOD="post" onSubmit="return fieldcheck()" name="orientation" action="http://ws-kitty.BU.edu/AT/survey/orientation/script/write.asp" language="JavaScript"> Joeyej Microsoft ASP .NET 0 4th Jun 2004 08:55 PM
Manual "Windows Update" produces "ActiveX/active scripting" error message even with "LOW" security level setting in "Trusted" Zone Ray2 Windows XP Help 1 14th Nov 2003 06:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:07 AM.