Conditional where part in Stored Procedures based on parameter

conditional_where

Many times there comes a situation when we have to add a conditional where part in stored procedure’s query based on the parameters that are been passed to the SP. ┬áLet’s take up an example with the following requirement.

We’ll create a SP “FindProduct” which will have two parameters @id and @searchString and it will return the posts that meet the passed parameters. We want to create our procedure as such that it search for the product if one of these parameter is passed.
Continue reading