You just put a condition in your query:
select *
from table1
where ( @city > 0
and column1 < @city )
or @city <= 0
Be careful; this can confuse the optimizer a bit and make your first query less efficient. Like all tests before implementation.
source
to share