>In VFP, if I have a logical field, I can do something like this:
>
>select iID, iif(lLogical, 'Open', 'Closed') from sometable
>
>This will return the word Open or Closed depending on the value of lLogical.
>
>Since SQL Server does not have an IIF function, how do I do the same thing using Transact SQL?
Assuming a bit field (or numeric) where 1 = True and 0 = False:
select iID, mylogical =
case
when llogical = 0 then 'Closed'
else 'Open'
end
from sometable
Insanity: Doing the same thing over and over and expecting different results.