Querying Data
After Connecting, you can execute a SQL statement and retrieve the results.
SELECT Procedure
You can use the query method to execute the statement. It will split the query results into batches, and invoke a callback once for each batch. The rows are given to the callback as a list of objects, along with a flag indicating whether more rows are available.
db.open("...", (err) => { db.query("SELECT Worker_Reference_WID, Legal_Name_Last_Name FROM [CData].[Human_Resources].Workers WHERE Legal_Name_Last_Name = 'Morgan'", (err, rows, moreRows) => { for (var i = 0; i < rows.length; i++) { var row = rows[i]; console.log("Worker_Reference_WID = " + row["Worker_Reference_WID"]); console.log("Legal_Name_Last_Name = " + row["Legal_Name_Last_Name"]); } if (!moreRows) { console.log("All rows have been processed"); } }); });