Reputation: 67
I am writing a query with a parameter.
So far, I only have something like this:
Select * From Table a
Where a.Column1 = @Value
Upvotes: 0
Views: 260
Reputation: 164089
What you want is all the rows where a.Column1 = @Value
and null
s only if @Value = 1
:
SELECT *
FROM tablename
WHERE (@Value = 1 AND Column1 IS NULL)
OR (Column1 = @Value)
Upvotes: 1