Forum Moderators: open

Message Too Old, No Replies

Error with SQL 2000 Function

Operator equals boolean XOR, type equals decimal

         

digitalv

8:21 pm on May 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can someone tell me what I'm doing wrong here? I'm trying to write a simple loan calculator - here is the function:

CREATE FUNCTION UDF_InterestCalculator (@P decimal(8,2),@DP decimal(8,2),@i decimal(8,2), @Y decimal(8,2))
RETURNS decimal(8,2) AS
BEGIN

DECLARE @Out as decimal(8,4)
SET @Out = ((@p - @dp) * @i / (12 * (1 - (1 + (@i / 12))^(-@y*12))))

RETURN @Out

END

When I try to save I get the following error:

Invalid operator for data type. Operator equals boolean XOR, type equals decimal

emsaw

4:36 am on May 25, 2006 (gmt 0)

10+ Year Member



digitalv,

^ means bitwise exclusive OR (XOR) in MSSQLese

Are you looking to do x to the power of y?

Look into the POWER function, as I think that's what you want.

HTH,

Mark