This post is for posterity purposes since we didn't find much on Google and would like to try and give back.
In Sqoop we recently were getting the error 'Error: java.io.IOException: SQLException in nextKeyValue' and 'Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid length parameter passed to the LEFT or SUBSTRING function.' when trying to import a specific view from SQL server. To troubleshoot this we listed out all the columns (--columns "Col1,Col2,Col3,Col4") and then removed one by one until the error stopped. That gave us the column that Sqoop was having trouble with. We then took that column and did a simple SELECT col4 from TABLE in our MS SQL query tool and sure enough, the same "Invalid length parameter" message popped up.
Turns out the SQL code creating the view on the MS SQL database had a bug in it. And so it really had nothing to do with Sqoop but bubbled up to us since we apparently are the only ones issuing a query against that column.
I guess the take away for us was, when running into odd SQL errors, remove Sqoop from the equation and make sure the query Sqoop is issuing runs successfully.
Cy Jervis, Community ManagerWas your question answered? Make sure to mark the answer as the accepted solution. If you find a reply useful, say thanks by clicking on the thumbs up button.Learn more about the Cloudera Community: Community Guidelines How to use the forum