CSV Data File Load errot for a SQL Server in Data factory pipeline

Mahesh Madhusanka 216 Reputation points
2020-11-08T14:12:31.537+00:00

Hi Team,

When I tiring to load a in a particular csv table file to SQL Server its getting error as a 'Received an invalid column length from the bcp client for colid 14' Bit there not provide any exact point or column on this. So Could you please support to sort out this issue, for your reference here with attached data factory pipeline error snap shot, could you please check and advise on this you r immediate response much appreciate.

38195-image.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,564 questions
0 comments No comments
{count} votes

Accepted answer
  1. HimanshuSinha-msft 19,471 Reputation points Microsoft Employee
    2020-11-10T00:06:12.21+00:00

    Hello @Mahesh Madhusanka ,

    Thanks for the ask and using the forum .

    You ahve not mentioned the about the data and and schema on the SQL side . I am pretty confident that the for col14 , the incoming record has size bigger then what is defined in SQL . Eg . The record is "Himanshu" , but the column is defined as varchar(5) , my name has 8 chars . The below animation will make it more clear .
    I am pasting the full error for others ( it may help others )

    Error code
    2200
    Troubleshooting guide
    Failure type
    User configuration issue
    Details
    ErrorCode=SqlBulkCopyInvalidColumnLength,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=SQL Bulk Copy failed due to receive an invalid column length from the bcp client.,Source=Microsoft.DataTransfer.ClientLibrary,**''Type=System.Data.SqlClient.SqlException,Message=The service has encountered an error processing your request. Please try again. Error code 4815. A severe error occurred on the current command. The results, if any, should be discarded.,Source=.Net SqlClient Data Provider,SqlErrorNumber=40197,Class=20,ErrorCode=-2146232060,State=1,Errors=[{Class=20,Number=40197,State=1,Message=The service has encountered an error processing your request. Please try again. Error code 4815.,},{Class=20,Number=0,State=0,Message=A severe error occurred on the current command. The results, if any, should be discarded.,},],'
    Source
    Pipeline
    p

    38522-data-issue.gif

    Fix

    Option 1

    Alter column on the sink side .

    ALTER TABLE foootabel1
    ALTER COLUMN Col2 varchar(10);

    Option 2 .

    If you want you can let the copy contnue with the action and it will log these records in a blob . You can enable the setting of fault tolerance as shown below .

    38612-2020-11-09-16-02-36.png

    Thanks Himanshu

    Please do consider to click on "Accept Answer" and "Upvote" on the post that helps you, as it can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Mahesh Madhusanka 216 Reputation points
    2020-11-10T03:59:20.277+00:00

    Hi @HimanshuSinha-msft Thank you, its worked.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.