node-mssql icon indicating copy to clipboard operation
node-mssql copied to clipboard

Cannot bulk insert into temporary table with msnodesqlv8

Open egmen opened this issue 9 years ago • 2 comments

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",

egmen avatar Sep 26 '17 11:09 egmen

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

bchopson avatar Jan 24 '18 13:01 bchopson

this should work OK now.

TimelordUK avatar Feb 04 '18 20:02 TimelordUK