My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 401: Bulk insert fails, but no error thrown
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


 
Reported by sylveste...@gmail.com, Jun 30, 2015
Posted this to the pyodbc group (https://groups.google.com/forum/#!topic/pyodbc/22gz4v64ZCw) then to stackoverflow (http://stackoverflow.com/questions/30758331/pyodbc-mssql-bulk-insert-fails-but-no-error-thrown) but have received no answer so far. 

What steps will reproduce the problem?
1. Create a table with a floating point column [A]
2. Bulk insert a file with the string 'NaN' instead of a floating point number [B]


What is the expected output? What do you see instead?

Expected output is an error because it should not be possible to insert a string in a floating point column. 
Instead, no error is thrown even though the bulk insert halts (and silently fails). You will see that the first row from the file (the number 1.1)is inserted

Note: When executing through MSSQL server studio I see an error as expected. The error is:

Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 2, column 1 (SomeNum).
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".


What version of the product are you using? On what operating system?

Python 2.7.2 on Windows 7, pyodbc version 2.1.8, sqlalchemy version 0.7.6

Please provide any additional information below.

[A]
CREATE TABLE TestBulkInsert (SomeNum FLOAT NOT NULL)

[B]
BULK INSERT MyDBName..testbulkinsert FROM 'see_attached_file' WITH (FIELDTERMINATOR= ',',ROWTERMINATOR= '\n',FIRE_TRIGGERS,CHECK_CONSTRAINTS,MAXERRORS= 0,BATCHSIZE= 1);
BulkInsertTest.txt
17 bytes   View   Download
Jun 30, 2015
#1 sylveste...@gmail.com
Forgot to mention that even though 1.1 (the first row) is inserted, 1.234 (the last row) is not. 

Powered by Google Project Hosting