If you are using MS SQL Server, create a stored proc and let the null
handlers like isNull() and nullIF() handle these for you.

A friend of mine showed me this little trick:

select
    column
from
    table
where
    IsNull(ID,'') = IsNull(NullIf(@ID,''),IsNull(ID,''))

This allows you to create an optional filter if the ID variable has a value
or not.  It acts very much like an if/elseif/else situation and repalces the
need for case statements.

The isNull and nullIF can be combined with other aspects of the query.

Teddy

On 9/27/06, Victor Moore <[EMAIL PROTECTED]> wrote:
>
> Thanks all.
>
> I think I will stick with the second one. Maybe more typing but it's
> cleaner.
>
> Cheers
> Victor
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254416
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to