开发者

Problem filtering in decimal datatype in Sql server

开发者 https://www.devze.com 2023-01-10 08:59 出处:网络
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).

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
0

精彩评论

暂无评论...
验证码 换一张
取 消