Bit Value check for 0 and 0,1 condition (Get all value if condition is false in bit) in where clause

Hi Techies,
    In this article i am going to get value if condition is false then get all records or if condition is true
then get only selected value in SQL server in where condition.


Select * From Table where  column1 !=    (CASE       WHEN @value=THEN              2       ELSE             0    END)

in this example if ,
 @value is 0 then it will get all records , but if  @value is 1 then it will be get those value where value is 1.

Bit Value check for 0 and 0,1 condition (Get all value if condition is false in bit) in where clause Bit Value check for 0 and 0,1 condition (Get all value if condition is false in bit) in where clause Reviewed by Ashwani on November 13, 2018 Rating: 5

No comments:

Powered by Blogger.