'case' returns a result and is by that a function. 'if' on the other hand,
is a procedural language construct.
[quoted text, click to view] <gg@xemaps.com> wrote in message
news:1150810453.571050.168010@c74g2000cwc.googlegroups.com...
> Why does this work:
>
> declare @x char(1)
> set @x = 'a'
>
> print case @x
> when 'a' then
> case when 50 > 40 then
> '50>40'
> end
> end
>
> But this gives a syntax error on the if statement?
>
> declare @x char(1)
> set @x = 'a'
>
> print case @x
> when 'a' then
> if 50 > 40
> '50>40'
> end
> end
>
> Can't you put an IF statement within a CASE statement?
>