sql server - How can I filter a SQL query by all matching values or all values and null values -


this query , not returning null values

select st.station stations st  ((station = case      when @station = n'*'      station      else @station end)   or (station = case       when @station = n'*'       null      else @station end)) 

try this:

select st.station stations st station = @station or @station = n'*' 

if pass '*' @station = n'*' evaluate true , select row, else filter value of @station variable.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -