I have a stored proc that takes several parameters, two of which allow nulls.
param1 = null [name]
param2 = null [id]
I want to implement the following logic:
if param1 is null then where clause = (where col2 like param2)
else if param2 is null then where clause = (where col1 like param1)
else where clause = (where col2 like @param2 and col1 like param1)
Param1 and param2 allow nulls but one must be filled out. If both param1 and param2 are left blank then no output is expected. I just can’t get the syntax right.
I have no idea what the question in there is, but I’ll offer: