A column length that is not valid for Colid X is received from the BCP client.

Source: Internet
Author: User

This problem occurs when inserting data in bulk.

Workaround: The length of the data should be greater than the defined length of the column corresponding to the data.

So one check is that the length of the column is beyond.

The network provides this method to find out exactly which column is longer than the length.

 Public voidgetfiledsizetest () {stringFilefullname =@"D:\GameLogs\2015-01-30_000000\Login.log"; //maximum length for each columndictionary<int,int> dicfieldlength =Newdictionary<int,int>(); //the line number of the maximum length of each columndictionary<int,int> dicmaxfieldlenthrownum =Newdictionary<int,int>();  for(inti =0; I < One; i++) {Dicfieldlength.add (I,0); Dicmaxfieldlenthrownum.add (i,0); } if(NewFileInfo (Filefullname). Length >0) {  using(StreamReader sr =NewStreamReader (Filefullname, Encoding.UTF8)) {   intRowNum =0;  while(Sr.) Peek () >-1)   {    stringStrrow =Sr.    ReadLine (); RowNum++; Object[] Objrow = Strrow.split (',');  for(inti =0; i < objrow.length; i++)    {       varlen=Objrow[i]. ToString ().        Length; if(Dicfieldlength[i] <Len) {Dicfieldlength[i]=Len; Dicmaxfieldlenthrownum[i]=RowNum; }     }   }  } }}

A column length that is not valid for Colid X is received from the BCP client.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.