>>Maybe I just drempt it but I thought somewhere I saw a TSQL construct other than the CASE WHEN that emulated the behavior of the VFP IIF()
>>
>>I'm converting a large number of local views in VFP to remote views and there are alot of IIF statements and I thought the last itme I did this I had seen an alternate way of doing it.
>>
>>CASE WHEN works fine but its bothering me that I can't remember where I saw this and I figure only other VFP folks would know what I'm talking about.
>
>
>I doubt this is it....but there's a COALESCE....that will return the first non-null...
>
>COALESCE( Col1, Col2 , Col3, Col4, 'default')
>
>That's the equivalent of...
>
>case when Col1 is not null then Col1
> when Col2 is not null then Col2
> when Col3 is not null then Col3
> when Col4 is not null then Col4
> else 'default' end
>
>Again, I doubt that's it, but it's the only one off the top of my head. Maybe someone either has a better memory, or can interpret your dream :)
Thanks, Don't think that was it, but it is an interesting thought.
So if I have (I didn't write this code) IIF(empty(mm.datefld), ?vp_dateparam, mm.datefld) in a VFP local view against DBFs and now the empty dates on the sql back end are null, I could express that as COALESCE(mm.datefld, ?vp_dateparam) or I guess in this case just ISNULL(mm.datefld, ?vp_dateparam).
( I think my brain has gone foggy - I have 932 views to convert and their syntax is often "creative")
Charles Hankey
Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy
Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.
-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin
Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.