A colleague of mine has been doing a lot of work lately with Node.js and found that there wasn’t yet an extension to access Microsoft SQL Server from the Windows build. His open source project – T-SQL FTW (For the Windows) – addresses that need. His first working build yesterday is an API with methods to Connect, Query, and Close.
The solution was developed using C# and ADO .NET managed code, with a C++ wrapper that Node.js can import and work with. Here’s a sample of how you might execute a query against a SQL Server database from within Node.js code (credit to gFosco for this):
var db = require('./tsqlftw').tsqlftwObject;
var mssql = new db();
mssql.Connect('server=localhost\\sqlexpress;Trusted_Connection=yes;database=MyDB;', function (err, data) {
mssql.Query('select * from myTable', function (err, results) {
console.log(err);
console.log(results);
results = JSON.parse(results);
console.log(results.count);
// result set is in results.rows and has a row number.
mssql.Close(function (err, results) {
console.log('Connection closed.');
});
});
});
Very impressive work and I’m excited to see where this goes.

