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
1
vote
2 answers

Inserting multiple rows into SQL Server from Node.js

I am working on a project that will upload some records to SQL Server from a node.js program. Right now, this is my approach (inside an async function): con = await…
Jorge Valentini
  • 397
  • 4
  • 17
1
vote
2 answers

Large float values are lost when inserted into SQL Server using Sequelize

Whenever I try to insert a floating point number larger than ~50k using the sequelize ORM, the database gets populated with something else. For this value 123456789.123456 I get this inserted 11186.78219. Some other colleagues have gotten different…
1
vote
0 answers

Unable to connect NodeJS app to MSSQL Linked server(Server Objects)

I want to connect to a Linked Server in a MSSQL server instance using my NodeJS App. I have all the required credentials like the hostname, port, username, password, linked server name, server object name etc. I am using node-mssql in my NodeJS…
1
vote
0 answers

Getting actual offset of a SQLServer DateTimeOffset column in Node

Using Node + mssql, I need to get the offset for the date that is returned from SQL Server for this query: SELECT getutcdate() AT TIME ZONE 'UTC' AT TIME ZONE 'Mountain Standard Time' The issue is it comes out of mssql/tedious already parsed as a…
Seth
  • 1,353
  • 1
  • 8
  • 17
1
vote
1 answer

Re-use prepared statements node-js mssql in a loop

I am working on a TS/NodeJS/MSSQL project and I basically want to iterate an array of something, let's say products, run a select query to determine if said product is in the database and if not insert it. The purpose of this exercise is to use…
Yiorgos
  • 151
  • 1
  • 11
1
vote
0 answers

Transaction error using node-mssql library

Hello I'm using the mssql library to insert some data into an SQL Server DB, the call is being executed inside a queue so if it fails it will retry in 1 min * retryAttemp up until 5 attempts however I keep getting this weird behavior where I get…
Carlos Delgado
  • 159
  • 1
  • 2
  • 15
1
vote
0 answers

Synchronize Elasticsearch index with SQL Server table

Is there any way to listen to SQL Server database changes (e.g. insert, update) from my node.js application? I want to keep my elasticsearch index synchronized with my database. And I can't figure out how to achieve this.
Zaid Waseem
  • 341
  • 1
  • 4
  • 13
1
vote
0 answers

Node Js api is failing

I have a Node JS api running on server. API is being used in angular application to load dropdown values. Sometime I have observed that empty dropdown render in browser. I checked logs of API. It has below details. problem updating cache in get. {…
Anil
  • 1,669
  • 5
  • 19
  • 44
1
vote
0 answers

Difficulty with node-mssql event listeners

My node app is crashing when node-mssql executes a stored procedure with a TVP parameter that violates its type's primary key constraint. events.js:183 throw er; // Unhandled 'error' event ^ Error: [Microsoft][SQL Server Native Client 11.0][SQL…
1
vote
3 answers

AWS Lambda timeout

I have an AWS Lambda function that connects to SQL DB and the timeout for lambda has been set to 120 seconds. But when there is some issue with the DB connection or query execution, lambda is getting timed out after 60 seconds. Below is my DB…
Abirami
  • 223
  • 6
  • 21
1
vote
1 answer

at node-mssql return the query result

function getAllCustomers() { const pool = new sql.ConnectionPool(config); const request = new sql.Request(pool); try { pool.connect(function () { request.query('select * from Customers', function (err, res)…
user9325093
1
vote
0 answers

How to use existing SQL Server pool connection using async/await patterns inside array.map using Promise.All

This code results in "Connection not yet open." error. The pool is connected and available for the first select where I am getting records to update. After I process my data I have an array of UPDATE statements. Then the inline async function runs…
Jeff Greer
  • 113
  • 7
1
vote
0 answers

MSSQL select query results are in different order in node mssql driver

I am using node-mssql package from npm to connect my MSSQL server. My code looks like const sql = require("mssql"); var sqlconnectionpool = new sql.ConnectionPool(...mydbconfig); sqlconnectionpool.connect().then(pool => { const myquery = "select…
Sriram
  • 767
  • 2
  • 17
  • 42
1
vote
2 answers

Can't get Node mssql to work properly

This is the way I'm using mssql at the moment but it gives sometimes errors: JavaScript: router.get('/academiejaren', (req, res) => { sql.connect(dbconfig, function (err) { var request = new sql.Request(); if (err) { …
Milan_w
  • 291
  • 2
  • 4
  • 17
1
vote
0 answers

Is it possible to continuously query newly added data from Microsoft SQL Server using node-mssql?

Here is the case: There is real-time data acquisition software continuously pushing new data to my SQL Server (about 8 rows per 1 sec). What I want to do is that using node-mssql and socket.io to get the newly added data, push them to the client…
Desmond Chen
  • 492
  • 5
  • 17