How can I use Like operator in mssql(node.js)
I'm using mssql(node.js). I want to execute SQL having LIKE.
But I can't find out in below page https://www.npmjs.com/package/mssql#input-name-type-value
my code is this.But it doesn't work(result is 0 record)
mssql.connect(config, function(err) {
var request = new mssql.Request();
request.input('name',mssql.NVarChar,name);
request.query("SELECT * FROM Table WHERE name LIKE '%@name%',function(err,data){
//
}
Try representing the entire LIKE
expression with a parameter, and then bind it using a concatenation, e.g.
var name = 'Yoshihide Nishimoto';
request.query("SELECT * FROM Table WHERE name LIKE ?", '%' + name + '%',
function(err, data) {
// code here
}
)