我想在 SQL Server 2008where
的语句部分添加一个案例。select
SELECT *
FROM CR_LOAN_DTL
WHERE
LOAN_ID = 1
AND REFERENCE_NO = CASE
WHEN @i_loan_id = 0 THEN >=1
CASE WHEN @i_loan_id = 0 THEN REFERENCE_NO >=1 and REFERENCE_NO <=9999999999999
ELSE REFERENCE_NO = @i_loan_id
END
它给了我一个错误:
">" 附近的语法不正确
我怎样才能解决这个问题?