0\" and the choices are \"Yes\", \"No\" and both using a multi-select dropdown box.The parameter gets passed to the stored" />
开发者

Can't figure out the syntax for a where clause

I have开发者_如何学C a report that contains the following parameter "Fine > 0" and the choices are "Yes", "No" and both using a multi-select dropdown box. The parameter gets passed to the stored procedure as either "Yes', "No" or "Yes, No".

In the SP has syntax similar to this

Case WHEN @FineAmount = 'Yes' THEN I.Fine > 0 
WHEN @FineAmount = 'No' Then I.Fine = 0
ELSE I.Fine >= 0
    END


Here's some case logic that will get the job done.

where
  I.Fine > case
    when @FineAmount like '%Yes%' then 0
    else I.Fine + 1 end
  or I.Fine = case
    when @FineAmount like '%No%' then 0
    else I.Fine - 1 end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜