本文介绍了我怎么会收到这个错误? Msg 8117,Level 16,State 1,Line 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我认为代码是正确的,因为没有更多的红线。但当我运行它时,它会显示以下消息:



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.

推荐答案




这篇关于我怎么会收到这个错误? Msg 8117,Level 16,State 1,Line 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 08:56