I have a Stored Procedure to get the details of Invoices
Some occasions I get the list of invoices by sending only the InvoiceID But in some other occasions I need to get the list of invoices as per the search fields supplied by the user. To do this I send all the fields to the Stored Procedure and use those parameters as below. I included only 2 columns but there are more.
SELECT * FROM INVOICES I
WHERE
(@InvoiceNumber is null or I.InvoiceNumber = @InvoiceNumber)
and
(@PONo is null or I.PONo = @PONo)
Is there a way to send the condition for the WHERE clause as one parameter?