On Jan 3, 2008 10:14 PM, Dave Crozier <[EMAIL PROTECTED]> wrote:
> Paul,
> You can't use a "do case" in a SQL statement, which is where icase is very
> useful along with iif. When I say can't I mean you'd have to use a carefully
> crafted UDF which is slow.

Sure you can.  Just not in Fox SQL :-)

SELECT a=CASE field1
   WHEN 1 THEN 'cat'
   WHEN 2 THEN 'dog'
   ELSE 'unknown'
   END
FROM mytable

or

SELECT a=CASE
   WHEN field1=1 THEN 'cat'
   WHEN field1=2 THEN 'dog'
   ELSE 'unknown'
   END
FROM mytable

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Paul Hill
> Sent: 03 January 2008 21:49
> To: ProFox Email List
> Subject: Re: Send text file to default printer
>
>
> On Jan 3, 2008 8:58 PM, Paul Newton <[EMAIL PROTECTED]> wrote:
> > Gigore
> >
> > With ICASE you can do something like this (in a single line/statement)
> >
> > x = ICASE(condition1, result1,condition2, result2, some_other_result)
> >
> > That's what it is designed for - and DO CASE does not do this (in a
> > single line/statement)
>
> Personally I would use a CASE statement as it's far more readable.  I
> suppose it could be handy in an index expression.
> It's not like we're in the old days where every byte/cycle counts.

-- 
Paul


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to