存储过程执行失败

时间:2019-02-28 16:51:12

标签: sql-server tsql stored-procedures

我对以下过程有疑问。

错误是:

  

消息402,级别16,状态1,过程Get_FormattedBankStatement,行   87.减法运算符中的数据类型nvarchar和nvarchar不兼容。

package com.company;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.shape.Rectangle;

public class Main extends  Application  {

    public static void main(String[] args)  {
        // write your code here
        launch(args);
    }

    public void start(Stage myStage) throws InterruptedException {
        myStage.setTitle("space invaders");

        Pane rootNode= new Pane();
        Scene myScene=new Scene(rootNode, 400, 800);
        myStage.setScene(myScene);
        Rectangle r = new Rectangle();
        myStage.show();
        rootNode.getChildren().add(r);
        r.setX(50);
        r.setY(50);
        r.setWidth(20);
        r.setHeight(20);

        for (int i = 0; i < 500; i++){
            Thread.sleep(2000);
            r.setTranslateY(i);
        }
    }
}

2 个答案:

答案 0 :(得分:0)

更改这些声明:

@NewBalance nvarchar(150),  
@PreviousBalance nvarchar(150);

收件人

@NewBalance DECIMAL(10,2),  
@PreviousBalance DECIMAL(10,2);

答案 1 :(得分:0)

感谢您的支持和见解。

通过将所有具有Decimal(18,2)的区域的数据类型更改为money,我得以解决该问题。变量@OpeningBalance Decimal(18,2)更改为@OpeningBalance money

@ DebitRecord,@ CreditRecord,@ NewBalance,@ PreviousBalance所做的操作相同

同样,通过合并PreviousBalance,CreditRecord和DebitRecord,“ Coalesce”用于计算新余额。

相关问题