views:

19

answers:

2

I want to fetch all the records that have null in openingbalance field of my voucher table in sql server 2005 database. That field is of type decimal(18,0). My query is

Select HeadCode,HeadName
from VoucherHead
where OpeniningBalanace = null

what am i doing wrong?

+2  A: 

You have to check for null using IS, rather than =

Select HeadCode,HeadName
from VoucherHead
where OpeniningBalanace IS null
p.campbell
+1  A: 

Hence the little difference:

Select HeadCode,HeadName
from VoucherHead
where OpeniningBalanace IS NULL
Jeroen