我在这里做错了什么?
CASE WHEN @Activity = 'XXXX' THEN
SET @AccrualBase = @PrevAccrualBase
SET @AccrualDate = @PrevAccrualDate
SET @All_In_Rate = @PrevAll_In_Rate
SET @AmtOut = @PrevAmtOut
END
我尝试在BEGIN END中查看4组语句,但没有运气。请指教
答案 0 :(得分:3)
Case是一个内联的sql语句,所以你正在做的事情有点痛苦。使用IF
IF @Activity = 'XXXX'
BEGIN
SET @AccrualBase = @PrevAccrualBase
SET @AccrualDate = @PrevAccrualDate
SET @All_In_Rate = @PrevAll_In_Rate
SET @AmtOut = @PrevAmtOut
END
答案 1 :(得分:2)
我认为您正在寻找IF声明:
IF @Activity = 'XXXX'
BEGIN
SET @AccrualBase = @PrevAccrualBase
SET @AccrualDate = @PrevAccrualDate
SET @All_In_Rate = @PrevAll_In_Rate
SET @AmtOut = @PrevAmtOut
END