Hello,
Is there a way to define a boolean with SQL Server 2005 (Express)
Thanks,Use a bit datatype. Values = 0 or 1
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"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,
>|||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,
>|||> 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.
Btw, did you see the new error message 2005 gives you when you try to say something like "WHERE
col"? Pretty informative...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uITOO12$GHA.204@.TK2MSFTNGP04.phx.gbl...
> 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
>> something like "WHERE col"? Pretty informative...
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
>> say something like "WHERE col"? Pretty informative...
> 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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment