c# - Re-factor simple SQL statement with WHERE clause -
i feel there must more efficient way this. want allow caller either pull books, or books not hidden (see below)
if isnull(@showhiddenbooks, 0) = 1 begin select (long list of fields) mytable myfield = @somefield end else begin select (long list of fields) mytable myfield = @somefield , ishidden = 0 end any thoughts?
thanks!
select * mytable myfield = @somefield , (ishidden = 0 or @showhiddenbooks = 1)
Comments
Post a Comment