如何使用nodejs-mssql执行存储过程以及select命令
How to execute stored procedure as well as select command using nodejs-mssql
我正在使用 node-mssql (https://github.com/patriksimek/node-mssql) 节点模块连接我的 SQL 服务器。
我有一些要求
declare @isTrue int
exec @isTrue = sp_isFolderExist @name='new folder',@FolderTypeID=1
select @isTrue
如何执行这个存储过程并得到isTrue
变量的值?
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
});
});
我正在使用 node-mssql (https://github.com/patriksimek/node-mssql) 节点模块连接我的 SQL 服务器。
我有一些要求
declare @isTrue int
exec @isTrue = sp_isFolderExist @name='new folder',@FolderTypeID=1
select @isTrue
如何执行这个存储过程并得到isTrue
变量的值?
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
});
});