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

Unable to Bulk Insert with NVARCHAR(MAX) Column #81

Closed
calebbriggs opened this issue Sep 25, 2014 · 7 comments
Closed

Unable to Bulk Insert with NVARCHAR(MAX) Column #81

calebbriggs opened this issue Sep 25, 2014 · 7 comments

Comments

@calebbriggs
Copy link

Problem I am having is that we already have a full schema setup and have quite a few columns that are NVARCHAR(MAX) in the database.

When doing a bulk insert into one of these tables we get the following error:

{ name: 'RequestError',
     message: 'Unicode data is odd byte size for column 9. Should be even byte size.',
     code: 'EREQUEST',
     precedingErrors: [] },
  refresh: false }

For testing, If we run an alter script to change the column to NVARCHAR(3999) and modify the bulk insert code accordingly, everything goes through just fine. However, altering all of these columns is not an option.

Any ideas or suggestions?

@bretcope
Copy link
Member

I'll look into this when I get a chance unless another maintainer beats me to it.

@bretcope
Copy link
Member

I'm going to track this here: tediousjs/tedious#197

@patriksimek
Copy link
Collaborator

Thanks @bretcope, closing this one.

@bretcope
Copy link
Member

bretcope commented Oct 8, 2014

@calebbriggs sorry for the delay in figuring out the problem. I've pushed a fix to Tedious which makes Bulk Load work for me with nvarchar(max). Can you update your Tedious dependency to 1.5.4 and verify that your problem has disappeared as well?

@calebbriggs
Copy link
Author

@bretcope updated my mssql and ran my tests. All are passing now with flying colors. Appreciate the help.

@calebbriggs
Copy link
Author

@bretcope are your tests still passing on this we were using a number larger than 4000
NVarchar(5000) . It says we can no longer exceed max length so we tried NVarchar('Max')
which did not work either.

@bretcope
Copy link
Member

What do you mean by "did not work"? That's essentially nothing to go on. There probably should be a test for nvarchar(max) in Tedious. If you run the repro script I put in the related Tedious issue, and it works, then it's not a Tedious problem. If it doesn't, then post the results and I'll take a look at it.

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

No branches or pull requests

3 participants