Friday, August 20, 2010

SQL query "when Null" will not work

SQL query Null will not work for the below case
select case amount when null then 0 else amount end from [Table]

Change this as below, this will work
select case when Amount is null then 0 else amount end from [Table]