Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!