I need a boolean field like yes/no in MS Access.
Isn't there such a data type in SQL Server?
What should I do ?
TIA,
CSharpHi,
Go for BIT data type. Bit will store either 1 or 0.
Thanks
Hari
MCDBA
"CSharp" <smitha@.asianetindia.com> wrote in message
news:e4cL2YuFEHA.3180@.TK2MSFTNGP12.phx.gbl...
> Hi all,
> I need a boolean field like yes/no in MS Access.
> Isn't there such a data type in SQL Server?
> What should I do ?
> TIA,
> CSharp
>|||... but please be aware that the bit datatype is not a Boolean datatype. Bi
t is a numeric datatype with the
values 1, 0 and NULL. It is up to the user to determine whether 1 means true
or false.
A Boolean datatype would have the truth-values "true", "false" and "unknown"
(all three are possible outcome
of a comparison, for instance). But since all datatype would need to represe
nt NULL as well, you have a bit
complexity to determine the difference etc between "unknown" and NULL, and I
believe that this is one of the
reasons why ANSI SQL-92 didn't define a Boolean datatype. SQL:1999 did, howe
ver, and AFAIK they essentially
ignored the possible differences between "unknown" and NULL.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Hari" <hari_prasad_k@.hotmail.com> wrote in message news:%23Y4GJfuFEHA.3912@.TK2MSFTNGP10.ph
x.gbl...
> Hi,
> Go for BIT data type. Bit will store either 1 or 0.
> Thanks
> Hari
> MCDBA
> "CSharp" <smitha@.asianetindia.com> wrote in message
> news:e4cL2YuFEHA.3180@.TK2MSFTNGP12.phx.gbl...
>|||Yep
Untill SQL Server 6.5 bit datatype could hold either a 1 or 0 and there was
no support for NULL. But from SQL Server 7.0 onwards, bit datatype can hold
also NULL. (My two cents

"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:e#8kaEwFEHA.712@.tk2msftngp13.phx.gbl...
> ... but please be aware that the bit datatype is not a Boolean datatype.
Bit is a numeric datatype with the
> values 1, 0 and NULL. It is up to the user to determine whether 1 means
true or false.
> A Boolean datatype would have the truth-values "true", "false" and
"unknown" (all three are possible outcome
> of a comparison, for instance). But since all datatype would need to
represent NULL as well, you have a bit
> complexity to determine the difference etc between "unknown" and NULL, and
I believe that this is one of the
> reasons why ANSI SQL-92 didn't define a Boolean datatype. SQL:1999 did,
however, and AFAIK they essentially
> ignored the possible differences between "unknown" and NULL.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Y4GJfuFEHA.3912@.TK2MSFTNGP10.phx.gbl...
>sql
No comments:
Post a Comment