Hi Einar!
Thanks for explaination - I didn't know this.
>Robert,
>Negative 2 should be the correct answer if I remember correctly from high school math. I took a look at what the help file had to say about MOD():
>
>MOD( ) Function
>Divides one numeric expression by another numeric expression and returns the remainder.
>
>MOD(nDividend, nDivisor)
>Return Values
>Numeric
>
>Parameters
>nDividend
>Specifies the dividend. The number of decimal places in nDividend determines the number of decimal places in the return value.
>nDivisor
>Specifies the divisor. A positive number is returned if nDivisor is positive, and a negative number is returned if nDivisor is negative.
>
>
>If the dividend is negative the divisor also has to be negative to get the desired result.
>Something like this would work:
>
>iDividend = -2
>iDivisor = 12
>?mod(iDividend, iif(iDividend<0, -iDivisor, iDivisor))
>
>
>Were you expecting negative 2 from VFP as well?
>
>Einar
>
>>Hi all!
>>
>>I've encountered a strange behaviour when using MODULO-function.
>>
>>
VFP8:>>MOD(10-12,12) = 10
>>
>>
SQL:>>(10-12) % 12 = -2
>>
>>I need to use Modulo in my sql-syntax - what have I done wrong???
>>
>>Thanks for help!
robert.oh.