sql server - sql query - true => true, false => true or false -
Simple query is probably impossible, but I know that there are some clever people :)
Boolean parameters, where do I want to define where no one can limit the output of the column or do anything.
Then, the given parameter @bt = 1 will result in:
where column = 1
given parameter @bt = 0 will result in: / P>
Where column = 1 or 0
means there is no result / display all results (column is a little area)
I do not want dynamic SQL - I It can be arranged to fix it in code but I wonder if there is some clever magic that is clean and simple than above.
Is there there? I am using SQL Server.
Cheers: D
Answer column = 1 or @bt = 0
works if the column can only be 0 or 1. If there is any value in the column then you want: column = 1 or @bit = 0 and column = 0
.
Comments
Post a Comment