1

I am using node-mssql (https://github.com/patriksimek/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 isTrue variable?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ashish Yadav
  • 99
  • 3
  • 5

1 Answers1

0
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
    });
});
Patrik Šimek
  • 1,038
  • 10
  • 14