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

Discussion in 'Access Table Design' started by croy, May 11, 2011.

  1. croy

    croy Guest

    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
     
    croy, May 11, 2011
    #1
    1. Advertisements

  2. On Wed, 11 May 2011 08:11:43 -0700, croy <> 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/Forums/en-US/accessdev/
    http://social.answers.microsoft.com/Forums/en-US/addbuz/
    and see also http://www.utteraccess.com
     
    John W. Vinson, May 11, 2011
    #2
    1. Advertisements

  3. John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in
    news::

    > On Wed, 11 May 2011 08:11:43 -0700, croy <> 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/
     
    David-W-Fenton, May 12, 2011
    #3
  4. On 12 May 2011 00:25:29 GMT, "David-W-Fenton"
    <> wrote:

    >John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in
    >news::
    >
    >> On Wed, 11 May 2011 08:11:43 -0700, croy <> 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
     
    Gene Wirchenko, May 18, 2011
    #4
  5. Gene Wirchenko <> wrote in
    news::

    > On 12 May 2011 00:25:29 GMT, "David-W-Fenton"
    ><> wrote:
    >
    >>John W. Vinson <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in
    >>news::
    >>
    >>> On Wed, 11 May 2011 08:11:43 -0700, croy <>
    >>> 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/
     
    David-W-Fenton, May 21, 2011
    #5
  6. On 21 May 2011 19:37:22 GMT, "David-W-Fenton"
    <> 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
     
    Gene Wirchenko, Jun 21, 2011
    #6
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin

    Yes/No Boxes Design

    Kevin, Jul 23, 2003, in forum: Access Table Design
    Replies:
    2
    Views:
    109
    Bruce M. Thompson
    Jul 24, 2003
  2. alicia

    Yes/No with no default

    alicia, Sep 18, 2003, in forum: Access Table Design
    Replies:
    3
    Views:
    113
  3. Avi

    yes/no option in a table

    Avi, Sep 19, 2003, in forum: Access Table Design
    Replies:
    0
    Views:
    82
  4. Daniel

    Yes/No

    Daniel, Oct 9, 2003, in forum: Access Table Design
    Replies:
    3
    Views:
    95
    Bruce M. Thompson
    Oct 9, 2003
  5. Melissa

    Yes/No queries as string

    Melissa, Oct 13, 2003, in forum: Access Table Design
    Replies:
    4
    Views:
    90
    John Vinson
    Oct 15, 2003
  6. Melissa

    yes/no queries as string continuum

    Melissa, Oct 15, 2003, in forum: Access Table Design
    Replies:
    0
    Views:
    84
    Melissa
    Oct 15, 2003
  7. David

    Yes/No column questions

    David, Nov 5, 2003, in forum: Access Table Design
    Replies:
    5
    Views:
    97
  8. Guest

    Can the yes or no box be removed

    Guest, Nov 19, 2003, in forum: Access Table Design
    Replies:
    1
    Views:
    58
    Jeff Boyce
    Nov 19, 2003
Loading...