Problem filtering in decimal datatype in Sql server
I want to fetch al开发者_StackOverflowl 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?
You have to check for null using IS
, rather than =
Select HeadCode,HeadName
from VoucherHead
where OpeniningBalanace IS null
Hence the little difference:
Select HeadCode,HeadName
from VoucherHead
where OpeniningBalanace IS NULL
精彩评论