要的不是分析结果,是解决方案,thx ^^

解决方案 »

  1.   

    看到你的方法之后,我在想不知道这样可行不?
    我先按你的,把所有的全导成一个字段,再删掉出错行,再接着导出文本,再然后重新导入....
    不过,导2kW数据,一次需要花的时间太长了,/pz
      

  2.   

    我现在先一步一步来解决....
    谢谢Herb2再看看大家还有没有别的解决方法,例如说强制还原,跳过出错行等方法
      

  3.   

    // mssqlsss.cpp : Defines the entry point for the console application.
    //#include "stdafx.h"
    #include "windows.h"
    #include "stdio.h"
    int Pass_fg(FILE *fp);
    int put_fg(FILE *fp,int q);
    int main(int argc, char* argv[])
    {
    int f=0;
    if(argc<2)
    {
    printf("file error\r\n");
    return 1;
    }
    FILE *fp,*newfp;
    char newfile[1024]={0};
    sprintf(newfile,"%s.txt",argv[1]); newfp=fopen(newfile,"wb");
    fp=fopen(argv[1],"rb");
    char c;
    int len=0;
    ULONG hang=0;
    while(!feof(fp))
    {

    c=fgetc(fp);
    if(c==0x0d)
    {

    if(len<41)
    {
    put_fg(newfp,len);
    len=0;
    c=fgetc(fp);
    continue;
    }
    else
    len=0;
    }
    // else
    // len=0;
    if(c==',')
    {
    len++;
    }
    if(len>=42)
    {

    Pass_fg(fp);
    fputc(0x0d,newfp);
    fputc(0x0a,newfp); len=0;

    }
    else
    fputc(c,newfp);
    }
    fclose(fp);
    fclose(newfp);
    return 0;
    }
    int Pass_fg(FILE *fp)
    {
    int c=0;
    while(1)
    {
    c=fgetc(fp);
    if(c==0x0a)
    break;
    }
    return 1;
    }int put_fg(FILE *fp,int q)
    {// printf("error  %d\r\n",q);

    for(;q<=40;q++)
    {
    // printf("写入,\r\n");
    fputc(',',fp);
    }
    fputc(0x0d,fp);
    fputc(0x0a,fp);
    return 1;
    }