>You'll get error in VFP as well because SQL MAX() has only one parameter. The MAX() in procedural code, that you're referring to, is totally different function.
>
>
>* VFP
>select IIF(FLD1 - FLD2 < 0, 0, FLD1 - FLD2) as NEWCOLUMN from MyTable
>
>
>select CASE WHEN FLD1 - FLD2 < 0 THEN 0 ELSE FLD1 - FLD2 END as NEWCOLUMN from MyTable
>
>
Do you know or do you think that SQL Server (and VFP too) evaluate the expression FLD1 - FLD2 twice or the engines are smart enough to only do it once? I am just curious if I should get the cursor with just the Days difference column and then process this cursor in VFP for negative values.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham