Skip to content

Instantly share code, notes, and snippets.

@etherealHero
Last active December 22, 2023 00:04
Show Gist options
  • Save etherealHero/ab10f8d564484ff1c97193c429786682 to your computer and use it in GitHub Desktop.
Save etherealHero/ab10f8d564484ff1c97193c429786682 to your computer and use it in GitHub Desktop.
NodeJS mssql by edge-js
const edge = require('edge-js');
const getProcedures = edge.func('sql', {
source: "SELECT TOP 10 name FROM sys.procedures",
connectionString: "Persist Security Info=False;Integrated Security=true;Initial Catalog=<database>;server=<server>"
});
const init = async () => {
const res = await new Promise((res, rej) => {
getProcedures(null, function (error, result) {
if (error) rej(error);
res(result);
});
})
res.map(a => console.log(a.name));
}
init();
/*
$ npm i edge-js edge-sql
$ node edge-sql.js
> pp_GetObjectFromPageId
sp_Locks
sp_MScleanupmergepublisher
sp_MSrepl_startup
sp_who3
$
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment