SQL Server Handling a null fields in Node.js and mssql module

gojuced7  于 2023-10-15  发布在  Node.js
关注(0)|答案(1)|浏览(101)

Trying to call sql server sproc from node.js using "mssql" module, when we call, it throws the error "EREQUEST", Error Details :"RequestError: Cannot insert the value NULL into column 'colName'". Don't know why but when run it on sql server it works as expected and gives the result. My Sproc containing the temp table and insert the null values in some of the columns.Please refer the following code.

var request = new sql.Request();
    request.input("param1", value1);
    request.input('param2', value2);

    request.stream = true;  
    request.execute('Sp_Name', function (err, recordset) {
    });

    var rows = [];
    request.on('row', function (row) {
        rows.push(row);
        console.dir(row);
    });

    request.on('error', function (err) {
        console.log('IN error =>' + err.code + "=>"  +err);

    });

    request.on('done', function (returnValue) {
        console.log('IN Done');
    });

thanks for your help..:)

相关问题