Re: Optional Where Parameters on Null Data
- From: Ed Murphy <emurphy42@xxxxxxxxxxxx>
- Date: Wed, 25 Apr 2007 09:28:21 -0700
BillCo wrote:
I have a procedure that I use to return data based on optional
parameters. It works fine, except when the underlying data contains a
null on one if the fields being searched.
My system uses a default wildcard for all parameters, so this excludes
such records. I need a way to add in " OR fldName IS NULL " where the
parameter is empty or '%'. I've looked at using CASE WHEN, but it
doesnt seem to like SQL Keywords being part of the WHEN clause.
Try this:
WHERE COALESCE(tblUnits.strUnitID,'') LIKE @strUnitID
etc.
.
- Follow-Ups:
- Re: Optional Where Parameters on Null Data
- From: --CELKO--
- Re: Optional Where Parameters on Null Data
- References:
- Optional Where Parameters on Null Data
- From: BillCo
- Optional Where Parameters on Null Data
- Prev by Date: OPENQUERY UPDATE Syntax help needed
- Next by Date: Re: Upgrade
- Previous by thread: Re: Optional Where Parameters on Null Data
- Next by thread: Re: Optional Where Parameters on Null Data
- Index(es):