Is ther a character that can be used yo match numeric datatypes similar to
the Like keyword and the % cbaracter?
I want to us a parameter that is a bit type and return records that true
false or both. In the WHERE clause I can get either true or false
field = 0 or feild = 1 but get stuck when I attempt field = 0 and 1
I have tried a CASE expression and an If condition but keep getting stuck
with theboth 0 and 1.
if these where strings i could do something like field Like '0' or field
Like '1' and field Like '%'In a situation like this, I typically allow a value of NULL for the input
parameter to shortcut a condition.
0 false
1 true
null both
. . .
where
(field = @.x) or
(@.x is null)
"Jim Abel" <JimAbel@.discussions.microsoft.com> wrote in message
news:D5478DF4-5D11-404C-9F1F-5BF1FE3FF9DA@.microsoft.com...
> Is ther a character that can be used yo match numeric datatypes similar to
> the Like keyword and the % cbaracter?
> I want to us a parameter that is a bit type and return records that true
> false or both. In the WHERE clause I can get either true or false
> field = 0 or feild = 1 but get stuck when I attempt field = 0 and 1
> I have tried a CASE expression and an If condition but keep getting stuck
> with theboth 0 and 1.
> if these where strings i could do something like field Like '0' or field
> Like '1' and field Like '%'|||>> I want to us a parameter that is a bit type and return records that true
What exactly are you trying to return by using "field = 0 and 1"?
When you have a column with bit dataype, no row in your table can have more
than one value for that column. So the predicate < bitcol = 0 AND bitcol = 1
> is always false.
Anith
No comments:
Post a Comment