Q:

Affected rows for stored procedure with node mssql object

I can't seem to get this working. I have an update procedure in Azure SQL. 
CREATE PROCEDURE foobar
    @a int
AS
        update foo set bar=@a;
RETURN 0

I was returning the @@rowcount and trying to work with that but it means two resultsets and sloppy code on the client side. The client being a node.js Azure Custom API.
exports.post = function(request, response) {
    var mssql = request.service.mssql;
    var sqlParams = [request.body.a];

    var sql = "foobar ?";

    mssql.query(sql, sqlParams, {
        success: function(results) {
                response.send(statusCodes.OK, results); //return affected rows
        }
    })
};

I've tried using results.affectedRows. I've tried using additional parameters in the function to get a return value. I've queried the database directly and receive '1 Records Affected' as a response. Even when I returned the @@rowcount I had problems specifying it in the javascript. As in I was returning for results:
    [{"affected":1}]
and attempting to access it with results[0].affected/results[0]["affected"] and various other permutations. I tried JSON.parse(results) and tried to access its properties then but still no go. It takes the Azure portal so long to update each time I'm just blindly trying different things at the minute. 
Stephen

A:

Of course after all that I found the correct documentation that suggests using queryRaw instead of query and wouldn't you know it, that returns a RowCount.
Stephen

