Sql server case statement in where clause
select * from table1 t1 where t1.active=1 and case when @x=1 then t1.name="" else t1.name<>"". please help to write it correct syntax
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Nov 27, 2020, 5:31 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Nov 27, 2020, 4:44 AM EST
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 27, 2020, 4:31 AM EST
P KRank #5,944 · 281 reputationPosted Nov 27, 2020, 4:56 AM EST
P KRank #5,944 · 281 reputationPosted Nov 27, 2020, 5:34 AM EST
P KRank #5,944 · 281 reputationPosted Nov 27, 2020, 4:33 AM EST
P KRank #5,944 · 281 reputationPosted Nov 27, 2020, 5:25 AM EST