From: simon on
I used to use CASE statement in JOIN, WHERE or ORDER BY statements.
Then I found out that
almost always execution times where much faster(even 5 times) if I
rewriten sql statement without case statements and execute it as
dynamic sql.
The more case statements I had, the faster execution time was with
dynamic sql compered to case statements.
Since than I use always dynamic sql instead of case statements. It was
newer slower than sql with case.

I don't have test script at the moment. You think that there are some
cases where CASE is faster?

thank you for your help,
Simon
From: Uri Dimant on
simon
I have benchmarked this situation as I try to use dynamic sql as a last
resort. It also depends on what indexes do you have a take a look into a
execution plan to compare performance




"simon" <zupan.net(a)gmail.com> wrote in message
news:f1bd56b2-09f1-41db-8593-71579d6b5711(a)x12g2000yqx.googlegroups.com...
>I used to use CASE statement in JOIN, WHERE or ORDER BY statements.
> Then I found out that
> almost always execution times where much faster(even 5 times) if I
> rewriten sql statement without case statements and execute it as
> dynamic sql.
> The more case statements I had, the faster execution time was with
> dynamic sql compered to case statements.
> Since than I use always dynamic sql instead of case statements. It was
> newer slower than sql with case.
>
> I don't have test script at the moment. You think that there are some
> cases where CASE is faster?
>
> thank you for your help,
> Simon