OPENROWSET BULK behaviour and lack of an ERRORFILE when it goes wrong
-
12-12-2019 - |
Question
I'm having great difficulty using OPENROWSET BULK
Basically, if it tries to insert a NULL into a NOT NULL column, it throws a run time error. If it tries to insert a non-number into an 'int' it throw a run time error. If I put a varchar(20) into a varchar(10) it throw a run time error. this list goes on....
I have specified an ERRORFILE, so why is it not putting the rows into the Error File?
If this is normal behaviour, then what does go in the error file?
Solution
The ERRORFILE is for rows that cannot be read from the data file. All the errors you quote are errors from failure to insert a successfully read row into the destination table. There is no way to circumvent those errors, you must import correct data into correct tables. Seems that what you want is more likely a fully fledged SSIS pipeline.