Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

multiple AND clauses with null option

$
0
0

I have a query that i cannot get quite right while using MS report builder 3.0 pulling from a SQL 2012 db.

SELECT * FROM regtesters.dbo.resreg reg

WHERE 
 (reg.regNumber = @regNumber OR @regNumber = '')
AND(reg.ersNumber = @ersNumber OR @ersNumber = '')

I want to be able to search by either variable.  Using the AND i get no results and if i use an OR i get the entire table.  I need help to figure out the correct syntax.


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>