Tuesday, March 27, 2012

Boolean ?

There is no Boolean datatype.
Most people use a BIT (0 or 1).
There are arguments for and against using CHAR(1) values with a check
constraint ('Y', 'N'), ('T', 'F').
You're better off with either of those than a (var)char(5) allowing 'TRUE'
and 'FALSE' as strings.
Oh, and you will never be able to shorthand WHERE column = 1 for WHERE
column, or WHERE column = 0 for WHERE NOT column. Even though the datatype
you choose (along with the cnstraints if necessary) may seem like a valid
boolean expression to you, SQL Server does not consider them as such.
A
"Gabriel" <nospam@.nospam.com> wrote in message
news:uw2bPk2$GHA.3380@.TK2MSFTNGP04.phx.gbl...
> Hello,
> Is there a way to define a boolean with SQL Server 2005 (Express)
> Thanks,
>
>> Btw, did you see the new error message 2005 gives you when you try to say[vbcol=seagreen]
Hehe, apparently there is some context that expects boolean type in SQL
Server !!!
Anith
|||>>> Btw, did you see the new error message 2005 gives you when you try to
> Hehe, apparently there is some context that expects boolean type in SQL
> Server !!!
Well, there are boolean expressions (not types), sort of, e.g.
WHERE EXISTS
(
...
)
|||Sorry, just wanted to clarify that I do get the joke. It's been a long day
here today.
|||>> It's been a long day here today.
Long Fridays, tell me about it :-)
Anith

No comments:

Post a Comment