>Hi All,
>
>Can I use IF or CASE statement in a computed column formula?
>If not can I create a User Defined Function and then use it in my column ?
>
>Basically this is what I am trying to do in my D column:
>
>If A = 1 Then B+C Else B End If
>
>Thank you,
>Daniel
SELECT CASE WHEN A = 1 THEN B+C ELSE B END AS Col1
FROM ....
...
or
SELECT B + CASE WHEN A = 1 THEN C ELSE 0 END AS Col1
FROM ....
...
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.