Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Invalid column type from bcp client for colid" - How to use sql.UniqueIdentifier column type? #285

Closed
MinsknBoo opened this issue Mar 21, 2016 · 5 comments

Comments

@MinsknBoo
Copy link

MinsknBoo commented Mar 21, 2016

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?

@aaronwilliams97
Copy link

aaronwilliams97 commented Sep 20, 2016

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

@jarekb84
Copy link

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

@renenjovalente-ubidy
Copy link

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)

@dhensby
Copy link
Collaborator

dhensby commented Jul 2, 2019

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

is the column nullable?

@akila543
Copy link

akila543 commented Sep 8, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants