awise
IS-IT--Management
- Dec 11, 2001
- 85
I have the following sql script that I am trying to use to update a field:
update rm00101
case a.code
when 1 set b.phone3='0'
when 5 set b.phone3='A'
when 3 set b.phone3='U'
when 4 set b.phone3='U'
when 0 set b.phone3='1'
end as b.phone3
from ageverifyresult a, rm00101 b
where a.custnmbr = b.custid
It fails on the second line, right after I start the case statement.
First question - is it possible to update a table's field using a case statement in this manner? If so, what is the proper syntax to accomplish this? If not, what is the recommended alternative?
Thanks,
Andrew
update rm00101
case a.code
when 1 set b.phone3='0'
when 5 set b.phone3='A'
when 3 set b.phone3='U'
when 4 set b.phone3='U'
when 0 set b.phone3='1'
end as b.phone3
from ageverifyresult a, rm00101 b
where a.custnmbr = b.custid
It fails on the second line, right after I start the case statement.
First question - is it possible to update a table's field using a case statement in this manner? If so, what is the proper syntax to accomplish this? If not, what is the recommended alternative?
Thanks,
Andrew