Node-mssql: Cannot bulk insert into temporary table with msnodesqlv8

Created on 26 Sep 2017  路  2Comments  路  Source: tediousjs/node-mssql

This code example from documentation throws error: RequestError: Table was not found on the server.
With tedious it`s OK.

'use strict'
const mssql = require('mssql/msnodesqlv8')

const connectString = `Driver={SQL Server Native Client 11.0};Server=sqlserver;Trusted_Connection=yes;`

mssql.connect(connectString)
  .then(() => {
    const table = new mssql.Table('#table_name')
    table.create = true
    table.columns.add('a', mssql.Int, {primary: true})
    table.columns.add('b', mssql.VarChar(50), {nullable: false})
    table.rows.add(777, 'test')

    const request = new mssql.Request()
    return request.bulk(table)
  })
  .then(console.log)
  .catch((err) => {
    console.error(err)
  })
"msnodesqlv8": "^0.4.9",
"mssql": "^4.1.0",

Most helpful comment

this should work OK now.

All 2 comments

I encountered this error as well with the same versions of msnodesqlv8 and mssql.

this should work OK now.

Was this page helpful?
0 / 5 - 0 ratings