View Single Post

   
  #6 (permalink)  
Old 02-29-2008, 02:22 AM
Kevin Frey
 
Posts: n/a
Default Re: Prepared Statement where value IS null or value = :x

> Try the following (assuming -1 isnt a possible value for <table>.<column>)
>
> SELECT * FROM <table> WHERE IsNull(<column>, -1) = IsNull(<value>, -1)
>
> I think this is sql-92 compatible as well


Yes, this is the kind of solution I am looking for. Does anyone have
any idea how the query optimiser will handle this when it comes time
to choosing appropriate indexes? On a simple test it seems it will
still utilise the correct index, but I'm not particularly confident.
Reply With Quote