I am attempting to setup two parameters in a SQL SELECT statement. I am collecting the values for these parameters via an SSRS report.
WHERE (SiteID = @paramSiteID OR ClientName LIKE '%'+@paramClientName+'%')
However, when the SiteID is provided, the SELECT statement is still using the LIKE portion of the statement and returning all records in the db. I am trying to achieve a result where if the SiteID is provided, it returns only that record (WHERE SiteID = @paramSiteID). Alternatively, if the user types data into the ClientName parameter, I would like to execute the LIKE clause. I would not like the user to be able to enter data in both fields.
Question: Is there a way to achieve this in SSRS? Is there a better way of structuring my query above to achieve the result that I would like?