Node-mssql: "Invalid column type from bcp client for colid" - How to use sql.UniqueIdentifier column type?

Created on 21 Mar 2016  路  5Comments  路  Source: tediousjs/node-mssql

Hey there,

i am trying to do a bulk insert with 15-20 columns, one of which is a UniqueIdentifier.

My MSSQL table column is a UniqueIdentifier.
I am using the node-uuid module to generate a v4 uuid and am trying to get it persisted (unsuccessfully).

  var table = new sql.Table('mytable'); 


    table.create = true;

    table.columns.add('item_type', sql.VarChar(50), {nullable: false});

    table.columns.add('total_events', sql.Int, {nullable: false});

    table.columns.add('guid', sql.UniqueIdentifier, {nullable: false});

    table.rows.add('aa',5,uuid.v4());

The above code will always throw "Invalid column type from bcp client for colid" Error. What type do i have to use to be able to do the insert?

bug unconfirmed

All 5 comments

Greetings, I hate to ask such a simple question, but were you sure to mind your nullable: true/false? That will throw the "Invalid column type from bcp client for colid ___"

Am I correct, Patrik?

Regards,
Aaron

@aaronwilliams97 Had the same issue and setting the nullable option fixed it for me.

I am getting the same error

RequestError: Invalid column type from bcp client for colid 38.
    at handleError (webpack:///./node_modules/mssql/lib/tedious.js?:426:15)
    at emitOne (events.js:115:13)
    at Connection.emit (events.js:210:7)
    at Parser.tokenStreamParser.on.token (webpack:///./node_modules/tedious/lib/connection.js?:716:12)
    at emitOne (events.js:115:13)
    at Parser.emit (events.js:210:7)
    at Parser.parser.on.token (webpack:///./node_modules/tedious/lib/token/token-stream-parser.js?:27:14)
    at emitOne (events.js:115:13)
    at Parser.emit (events.js:210:7)
    at addChunk (webpack:///./node_modules/tedious/node_modules/readable-stream/lib/_stream_readable.js?:297:12)
    at readableAddChunk (webpack:///./node_modules/tedious/node_modules/readable-stream/lib/_stream_readable.js?:279:11)
    at Parser.Readable.push (webpack:///./node_modules/tedious/node_modules/readable-stream/lib/_stream_readable.js?:240:10)
    at Parser.Transform.push (webpack:///./node_modules/tedious/node_modules/readable-stream/lib/_stream_transform.js?:139:32)
    at doneParsing (webpack:///./node_modules/tedious/lib/token/stream-parser.js?:80:14)
    at token (webpack:///./node_modules/tedious/lib/token/infoerror-token-parser.js?:48:5)
    at call.lineNumber (webpack:///./node_modules/tedious/lib/token/infoerror-token-parser.js?:13:19)

Had the same issue and setting the nullable option fixed it for me.

is the column nullable?

@willmorgan jarekb84 is this issue resolved. i have nullable as true and am getting the same error

Was this page helpful?
0 / 5 - 0 ratings