Home > database >  compare nullable param to non-nullable column
compare nullable param to non-nullable column

Time:06-01

I have a non-nullable bit column and in my Select statement I would like to only compare it with a nullable param if that nullable param is not null. What's the best way of doing this? There are other conditions in the where clause though I would still like to execute.

CodePudding user response:

This sounds like a typical "kitchen sink" kind of query. It would help your question if you provided some details other than a vague explanation. I think you are looking for something like this.

and (@YourParam is null OR [YourBit] = @YourParam)
  • Related