Questions tagged [node-mssql]

node-mssql MSSQL database connector for Node.js.

https://tediousjs.github.io/node-mssql/

An easy-to-use MSSQL database connector for Node.js.

There are some TDS modules which offer functionality to communicate with MSSQL databases but none of them does offer enough comfort - implementation takes a lot of lines of code. This module make work as easy as it could without losing any important functionality. node-mssql uses other TDS modules as drivers and offer easy to use unified interface. It also add extra features and bug fixes.

202 questions
2
votes
1 answer

Error while running node-mssql query

I am trying to run node-mssql query, if I run simple quires it is getting executed. But when I use OPENROWSET and Microsoft.ACE.OLEDB.12.0, it is showing some errors. Here is server.js code var express = require('express'); var app =…
naik3
  • 319
  • 2
  • 8
  • 22
2
votes
1 answer

Error invalid object name when connectin with node-mssql

I am using the following code to connect to Ms SQL-Server var node_mssql = require('node-mssql'); /* add configuration to query object */ var queryObj = new node_mssql.Query({ host: '127.0.0.1', // You can use 'x.x.x.x\\instance' to connect…
Mathias F
  • 15,906
  • 22
  • 89
  • 159
2
votes
1 answer

nodejs mssql return recordset

Im trying to past the recordset from mssql request.query like a return value. Following the code on https://www.npmjs.com/package/mssql is easy to make a a console output but when I try to asign the recordset to another variable doesnt work. What Im…
JiJiJiAR
  • 21
  • 1
  • 1
  • 3
2
votes
3 answers

How to access the output parameter in node mssql?

` request.input('xyz',sql.Int,1); request.input('abc',sql.Numeric,2); request.output('pqr',sql.Int); request.output('def',sql.Char); request.execute('[StoredProcedure]',function(err,recordsets,returnvalue){ …
Prateek Dhuper
  • 235
  • 4
  • 14
2
votes
0 answers

Why does a SQL Server Query from NodeJS return a date object representing the day before the stored date?

I am writing a NodeJS application which uses SQL Server as a data store. Node connects to SQL Server using the mssql native driver. When I select a date object from the database with an empty time field, the date before the stored date is being…
JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
2
votes
1 answer

Run multiple MSSQL queries in node.js

I am trying to run multiple SQL queries. The problem is that variables keep going out of scope due to fire-and-forget node.js uses. I am trying to work out how to do something similar to the await keyword in C#. Here is my broken code, as is; which…
dannybrown
  • 1,083
  • 3
  • 13
  • 26
1
vote
2 answers

Query returns string instead of int using Typescript/Javascript

Currently I have this typescript/javascript function that connects to my SQL Server and returns data. async function SQLQuery(query: string, database: string) { try { #connects to custom pool manager const pool = await…
1
vote
0 answers

Node.js - multiple websocket and SQL Server connection

I am working on an application that needs to listen to a WebSocket and make changes to a remote SQL Server database for each user. Each user has their own WebSocket and database. The application previously worked locally on a computer and only…
freya
  • 11
  • 2
1
vote
1 answer

Node mssql complete stacktrace

Why don't i get a stacktrace pointing to the excution point of my file const sqlSelect = "error"; const result = await sql.query(sqlSelect); result: err = new RequestError(err, 'EREQUEST') ^ RequestError: Could not find stored…
lars1595
  • 886
  • 3
  • 12
  • 27
1
vote
1 answer

Workaround two-statement query (DECLARE; SELECT) in node-mssql GET request required due to bug in SQL Server 2019 Linux

Due to a bug in SQL Server 2019 Linux, a node-mssql GET query that should be one single statement: router.get('/getresult/:srid/:x/:y', function (req, res) { sql.connect(config, error => { new sql.Request() .input('srid',…
Rayner
  • 128
  • 9
1
vote
2 answers

mssql - uncaughtException in Stream Mode

I'm facing the same issue as mentioned here: When trying to use stream and query a table without mentioning the schema. Something like select * from table instead of select * from schema_name.table. I get the following error: mssql uncaughtException…
Oron Bendavid
  • 1,485
  • 3
  • 18
  • 34
1
vote
2 answers

Unable to run node application using pm2

I made a small nestjs webapp, it connects to a local mssql database and works fine... Except if I try to launch it using pm2. regular yarn start:dev works (it translates to nest start --watch) building the production and running yarn start:prod…
Bruno Lamps
  • 544
  • 6
  • 27
1
vote
1 answer

NodeJS: Verify if sql query was successful

I made a very simple api in nodejs to use my flutter app with a sqlserver database and i have a doubt. How can i make a verification if the query was successul to return different results? I'm trying to do a update after a succesful insertm but i…
abrev
  • 305
  • 4
  • 18
1
vote
1 answer

Convert nested array to nested object

I'm using typeorm to get data form DB and I want to list all my issues with the last status for each issue. My database has 2 tables: Issues and IssueStatus Into IssueStatus I'll save every status changing and comments about how to solve the…
Glenn Mateus
  • 319
  • 1
  • 2
  • 17
1
vote
0 answers

node-mssql SQL injection warning when executing stored procedure with UPDATE statement

I tried to execute a stored procedure in node-mssql that performs a SQL update: Javascript code : const request = new sql.Request(); request.input('name', sql.NVarChar, req.body.name); request.input('id', sql.BigInt, req.body.id); await…
GregD
  • 11
  • 2