title: node-mssql error message when trying to do a bulk insert (While reading current row from host, a premature end-of-message was encountered)
body: <p>When trying to use the <code>.bulk</code> operation of <code>node-mssql</code> lib in node.js, i'm receiving the message:</p>
  <pre><code>While reading current row from host, a premature end-of-message was encountered--an incoming data stream was interrupted when the server expected to see more data. The host program may have terminated. Ensure that you are using a supported client application programming interface (API)
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>// the problem happens when i call this function
  export async function insert(
    transaction: sql.Request,
    data: any[],
  ) {
    const table = prepare(data);
    return await transaction.bulk(table);
  }
  
  function prepare(data: any[]) {
    const table = new sql.Table('dbo.SomeTable');
    table.create = false;
    table.columns.add('MyColumn1', sql.Int, { nullable: false });
    table.columns.add('MyColumn2', sql.Int, { nullable: false });
    table.columns.add('MyColumn3', sql.Int, { nullable: false });
  
    for (const mov of data) {
      table.rows.add(
        mov.field1,
        mov.field2,
        mov.field3
      );
    }
    return table;
  }
  </code></pre>