Hi
I was thinking the codes were correct because there as no more red lines. But when I run it, it shows this message:
Msg 8117, Level 16, State 1, Line 6<br />
Operand data type varchar is invalid for divide operator
Here is my query:
SELECT b.pnNumber
,b.loanAmount
,b.term
,((CAST(SUBSTRING(b.interestRate, PATINDEX('%[^0 ]%', b.interestRate + ' '), LEN(b.interestRate)) AS FLOAT) /100)/12) monthlyInterestRate
,POWER(((CAST(SUBSTRING(b.interestRate, PATINDEX('%[^0 ]%', b.interestRate + ' '), LEN(b.interestRate)) AS FLOAT) /100)/12), b.term) SuperScript
,CASE WHEN b.interestRate = 0 THEN b.loanAmount/b.term ELSE
(b.loanAmount*((((CAST(SUBSTRING(b.interestRate, PATINDEX('%[^0 ]%', b.interestRate + ' '), LEN(b.interestRate)) AS FLOAT) /100)/12)*POWER(((CAST(SUBSTRING(b.interestRate, PATINDEX('%[^0 ]%', b.interestRate + ' '), LEN(b.interestRate)) AS FLOAT) /100)/12), b.term))-(POWER(((CAST(SUBSTRING(b.interestRate, PATINDEX('%[^0 ]%', b.interestRate + ' '), LEN(b.interestRate)) AS FLOAT) /100)/12), b.term)-1))) END MonthlyPayment
FROM vw_LoanMas_AcctRel AS b
WHERE b.billingBucket1 = 'U'
Thank you for helping me out in my problem.