if 条件和计数器增量
这个if条件有什么问题吗?
if ((@rent_amt_h <> '0.000') or (@house_payment_amt_h <> '0.000') or (@insurance_amt_h <> '0.000')or (@property_taxes_amt_h <> '0.000') or (@gas_amt_u <> '0.000') or (@elec_amt_u <> '0.000') or (@otherfuel_amt_u <> '0.000') or (@Trash_Collection_amt_u <> '0.000') or (@Sewerage_amt_u <> '0.000') or (@Telephone_amt_u <> '0.000') or (@water_amt_u <> '0.000') or (@other_house_amt_h <> '0.000') or (@other_amt_u <> '0.000') or (@total_u <> '0.000'))
begin
SET @APPSHELTER_COUNT = (select Count(APP_ID) FROM ext_app_group_other_expenses (nolock) WHERE APP_ID = @App_Id )
end
else
begin
SET @APPSHELTER_COUNT = 0
end
它会增加 @APPSHELTER_COUNT 值,即使 if 条件中的值为零!。它永远不会将该值设置为 0?
感谢您的帮助。
What wrong with this if condition?
if ((@rent_amt_h <> '0.000') or (@house_payment_amt_h <> '0.000') or (@insurance_amt_h <> '0.000')or (@property_taxes_amt_h <> '0.000') or (@gas_amt_u <> '0.000') or (@elec_amt_u <> '0.000') or (@otherfuel_amt_u <> '0.000') or (@Trash_Collection_amt_u <> '0.000') or (@Sewerage_amt_u <> '0.000') or (@Telephone_amt_u <> '0.000') or (@water_amt_u <> '0.000') or (@other_house_amt_h <> '0.000') or (@other_amt_u <> '0.000') or (@total_u <> '0.000'))
begin
SET @APPSHELTER_COUNT = (select Count(APP_ID) FROM ext_app_group_other_expenses (nolock) WHERE APP_ID = @App_Id )
end
else
begin
SET @APPSHELTER_COUNT = 0
end
It increments the @APPSHELTER_COUNT value, even the values in if condition are zero!. It never sets the value to 0?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那是什么语言?不管怎样,感觉就像你在比较数字和字符串。尝试删除零周围的引号。例如
@rent_amt_h <> 0
而不是@rent_amt_h <> '0.000'
。另外,如果这是一些 SQL,请确保处理NULL
< /a> 正确,因为NULL != 0
。What language is that? Anyway, it feels like you are comparing numbers with strings. Try removing quotes around your zeros. For example
@rent_amt_h <> 0
rather than@rent_amt_h <> '0.000'
. Also, if that is some SQL, make sure you handleNULL
correctly, becauseNULL != 0
.