Trying to create a condition wherein if a particular field matches then use a formula.
Insert into #table1 SELECT CASE WHEN fld1 IN ('A','B','C') THEN fld2 = '1', fld3 = '2' WHEN fld1 IN ('D','E','F') THEN fld2 = '2', fld3 = '1' ELSE END FROM SomeTable
asked Jan 23, 2013 at 01:01 AM in Default
So you're trying to set both Fld1 and fld2 based on the value in fld1?
Two ways of doing this come to my mind. First, use a single CASE statement for each of fld2 & fld3:
Alternatively, you could try:
answered Jan 23, 2013 at 07:41 AM