Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda