I have a table that has a bit field called PHI, the user will specift true
(1) or false (0) in the application, but I want to if it is true return all
1 and 0 marked fields and if false only the 0 bit marked fields. How would I
write a query to include both if true and only false ones if false? thanks!
my wear clause right now looks like this (PHI = @.PHI), which of course only
includes one or the other.PHI <= @.PHI
Jacco Schalkwijk
SQL Server MVP
"Brian Henry" <nospam@.nospam.com> wrote in message
news:%234zfS2qkFHA.3316@.TK2MSFTNGP14.phx.gbl...
>I have a table that has a bit field called PHI, the user will specift true
>(1) or false (0) in the application, but I want to if it is true return all
>1 and 0 marked fields and if false only the 0 bit marked fields. How would
>I write a query to include both if true and only false ones if false?
>thanks!
> my wear clause right now looks like this (PHI = @.PHI), which of course
> only includes one or the other.
>|||oh that was so simple... was thinking of booleans where you cant really say
that in some languages...
"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid> wrote
in message news:%23A2LJ7qkFHA.4000@.TK2MSFTNGP12.phx.gbl...
> PHI <= @.PHI
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Brian Henry" <nospam@.nospam.com> wrote in message
> news:%234zfS2qkFHA.3316@.TK2MSFTNGP14.phx.gbl...
>|||The bit datatype is not a Boolean datatype. It is just an integer class data
type with values
restricted to 0, 1 and NULL. The only confusing (and IMO bad) thing about th
is bit datatype is
below:
DECLARE @.b bit
SET @.b = 27
SELECT @.b --returns 1
All non-0 values are converted to 1. IMO, the SET should return a datatype c
onversion error instead.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Brian Henry" <nospam@.nospam.com> wrote in message news:ejy2HErkFHA.3256@.TK2MSFTNGP12.phx.g
bl...
> oh that was so simple... was thinking of booleans where you cant really sa
y that in some
> languages...
>
> "Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid> wro
te in message
> news:%23A2LJ7qkFHA.4000@.TK2MSFTNGP12.phx.gbl...
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment