Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Where xxx in with condition

Author  Topic 

micnie_2020
Posting Yak Master

232 Posts

Posted - 2015-01-14 : 22:05:27
Hi All,

I try to do:-

where Status IN(case when @incDel=1 THEN 1,0 ELSE 0 END)

But not work.
I need if @incDel=1; where Status IN(0,1) else only where Status IN(0)

Please advise.

Thank you.

Regards,
Micheale

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-01-15 : 01:05:41
where status = case ...
Go to Top of Page

ScottPletcher
Aged Yak Warrior

550 Posts

Posted - 2015-01-15 : 11:18:18
where (Status = 0 or (@incDel=1 and Status = 1))
Go to Top of Page
   

- Advertisement -