This is the where clause of my query:
WHERE person.personstatusuid = @StatusUID
AND person.forename != ''
this works fine - @StatusUID is coming from a drop down box.
However, I also have a location field. This code works fine too:
WHERE person.personstatusuid = @StatusUID AND person.forename != '' AND person.Location = @Location
I want to change the last line to be if it is the @Location (which comes from a text box) or the @Location is empty.
I tried using an OR as was suggested, but no matter what I try, it does not return any rows. I have tried replacing the line with this, just for testing purposes:
AND (@Location NOT LIKE 'BISCUITS' )
AND (@Location!='' )
AND (LEN(@Location) == 0 )
but none of them work when I leave the text box blank.
Any ideas?