You are here: Re: Optional Where Parameters on Null Data « MsSQL Server « IT news, forums, messages
Re: Optional Where Parameters on Null Data

Posted by Ed Murphy on 04/25/07 16:28

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация