December 3, 2003 at 10:32 am
I have the following query.
select @1 = field1,
case field2
when 'A' then 'X'
when 'B' then 'Y'
else 'Z'
end as customfield1,
'customfield2' =
case
when field3 = 'R' and field4 = 'S' then 'F'
when field3 = 'T' and field4 = 'U' then 'G'
end
from mytable
As you can see, I know how to assign the value of a field to a variable using SELECT, what I don't know how to do is to assign the result value of a CASE statement to a variable. In this sample case, I want to assign the value of CUSTOMFIELD1 and CUSTOMFIELD2 to variables.
Can anyone out there help me?
Thanks,
Jason
----------------------------------------------------------01010011010100010100110000100000010100110110010101110010011101100110010101110010001000000101001001101111011000110110101101110011
December 3, 2003 at 10:39 am
Duh, never mind, I found it. In my real code I had another error that I couldn't get past to see the problem with the code I sent here.
Thanks anyway.
----------------------------------------------------------01010011010100010100110000100000010100110110010101110010011101100110010101110010001000000101001001101111011000110110101101110011
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply