I am trying to get something lik this working:
select .....
where
...
and user_id =
case @.userid
when <> 0 then @.userid
end
I need to conditionally use user_id = @.userid
when @.userid <> 0
Thankswww.sommarskog.se/dyn-search.html
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--
"Mark Goldin" <mgoldin@.ufandd.com> wrote in message
news:%23clOHZ5PFHA.2000@.TK2MSFTNGP15.phx.gbl...
> I am trying to get something lik this working:
> select .....
> where
> ...
> and user_id =
> case @.userid
> when <> 0 then @.userid
> end
> I need to conditionally use user_id = @.userid
> when @.userid <> 0
> Thanks
>sql
Tuesday, March 20, 2012
CASE in Select
Labels:
case,
conditionally,
database,
lik,
ltgt,
microsoft,
mysql,
oracle,
select,
server,
sql,
user_id,
useridendi,
useridwhen,
workingselect
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment