Ashish Yadav Ashish Yadav - 7 months ago 38
Node.js Question

How to execute stored procedure as well as select command using nodejs-mssql

I am using node-mssql ( node module to connect my SQL Server.

I have requirement some thing like

declare @isTrue int
exec @isTrue = sp_isFolderExist @name='new folder',@FolderTypeID=1
select @isTrue

How to execute this stored procedure and get the value of the

var sql = require('mssql');

sql.connect("mssql://username:password@localhost/database", function(err) {
    // ... error checks

    new sql.Request()
    .input('name', 'new folder')
    .input('FilterTypeID', 1)
    .execute('sp_isFolderExist', function(err, recordsets, returnValue) {
        // ... error checks

        console.log(returnValue); // your isTrue value