【发布时间】:2011-05-20 20:59:05
【问题描述】:
这个 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?
感谢您的帮助。
【问题讨论】:
-
您的 if 语句中有 14 个子句 - 难以阅读且无法维护
标签: if-statement counter conditional-statements increment