IF ELSE Statement in SQL
    SELECT S.Id, S.Name, S.Version, S.SoftNo
    FROM SOFTWARE S WITH(NOLOCK)
    WHERE (IF S.Version = 0 THEN S.Version > 0 ELSE S.Version = @Version)
    AND (IF S.SoftNo = 0 THEN S.SoftNo > 0 ELSE S.SoftNo = @SoftNo)

If Version is equal to zero, I want to list everything version number is greater then 0 if it is not equal to 0, then Version should be whatever it is value.

This is same for SoftNo.

How can I fix my SQL query. It just doesn't work.
IF ELSE Statement in SQL
===

    SELECT S.Id, S.Name, S.Version, S.SoftNo
    FROM SOFTWARE S WITH(NOLOCK)
    WHERE (IF S.Version = 0 THEN S.Version > 0 ELSE S.Version = @Version)
    AND (IF S.SoftNo = 0 THEN S.SoftNo > 0 ELSE S.SoftNo = @SoftNo)

If Version is equal to zero, I want to list everything version number is greater then 0 if it is not equal to 0, then Version should be whatever it is value.

This is same for SoftNo.

How can I fix my SQL query. It just doesn't work.