The below basic code should work as expected, you just need to substitute in your specific DB details for the connection Config and the query. Also remember to include the ‘mssql’ NPM package as a dependency
export async function run() {
var sql = require("mssql");
// config for your database
var config = {
user: '', // username
password: '', // password
server: '', // your server address
database: '' // your DB ID
};
let tableName = 'someTableName';
// connect to your database
await sql.connect(config);
let results = await sql.query(`select * ${tableName}`);
console.log("Results: ", JSON.stringify(results))
}