Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
Update multiple rows and columns using respective ids in mssql

I extracted data from database in excel format using sql join query. I modified few columns data in to that exce sheet. I want update modified data into database using respective row ids. When I iterate stack: Error: aborted is thrown.

below is my code

sql.connect(db, async (err)=> {
  if (err)
    console.log(err);
  var request = new sql.Request();
var workbook = XLSX.readFile('2021-08-30-202129.xlsx');
var sheet_name_list = workbook.SheetNames;
var xlData = XLSX.utils.sheet_to_json(workbook.Sheets[sheet_name_list[1]]);
console.log(xlData);
xlData.forEach(async (item)=>{
  let returnquery = await ` UPDATE [billing] SET notes='${item.notes}' WHERE id='${item.id}'`
    request.query(returnquery, function (err, result) {
      if (err) {
        console.log(err)
      }
      else{
        console.log('result', result);
      }
      sql.close();
    }); 
  })
  }); 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I typically use the workbench app, and open a query window, to ensure I have the correct SQL syntax. (console.log your sql statement right before you call the DB, then copy it over to the workbench).

I usually have some small typo issue, and this allows me to easily figure that out, then go back to the code and fix the error.

I also think you have issues with having ' by your variables. those should be removed since you're already in `` style. SQL will misinterpret those.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda