node.js with SQL Server Native Client 11 scope_identity not being returned
- by binderbound
I'm having trouble with inserting a value into a database through node.js. Here is the offending code:
sql.query(conn_str
,"INSERT INTO Login(email, hash, salt, firstName, lastName) VALUES(?, ?, ?, ?, ?);
SELECT SCOPE_IDENTITY() AS 'Identity';"
, [email, hash, salt, firstName, lastName], function(err, results){
console.log(results)
}
Unfortunately, the console is just echoing [], meaning results is an empty array, I suppose.
Does anyone know why the identity is not being returned? Even if it was null, why isn't results then [{Identity: null }] ?
Database is on Azure, which does have a "Scope_Identity" function, and the native client also recognises this function.
Using node package "msnodesql"
Please Help