Import CSV File Error : Column Value containing column delimiter

后端 未结 3 880
花落未央
花落未央 2020-12-20 09:40

I am trying to Import a Csv File into SQL SERVER using SSIS

Here\'s an example how data looks like

Student_Name,Student_DOB,Student_ID,Student_Notes         


        
3条回答
  •  感情败类
    2020-12-20 10:20

    In The Flat File Connection Manager. Make the File as only one column (DT_STR 8000)

    Just add a script Component in the dataflowtask and Add Output Columns (Same as Example Shown)

    in The script component split each row using the following Code:

    \\Student_Name,Student_DOB,Student_ID,Student_Notes,Student_Gender,Student_Mother_Name
    
    Dim strCells() as string = Row.Column0.Split(CChar(","))
    
    Row.StudentName = strCells(0)
    Row.StudentDOB = strCells(1)
    Row.StudentID = strCells(2)
    Row.StudentMother = strCells(strCells.Length - 1)
    Row.StudentGender = strCells(strCells.Length - 2)
    
    Dim strNotes as String = String.Empty
    
    For int I = 3 To strCells.Length - 3
    
    strNotes &= strCells(I)
    
    Next
    
    Row.StudentNotes = strNotes
    

    it worked fine for me

提交回复
热议问题