SQL Server Performance

how to use multiple delimiters for a flat file while creating the packages

Discussion in 'SQL Server 2005 Integration Services' started by gopiganguly, Sep 6, 2007.

  1. gopiganguly New Member

    Hi everyone,

    There is a small problem encountered while creating a package in sql
    server 2005.
    Actually i am using a flat file which has 820 rows and 2 columns which
    are seperated by line feed(for ROW) and tab(for COLUMN).after
    importing i found that ther are only 800 rows imported into the table.
    Ather verifying the input file i found out that there are some null
    values in the second column so there is no line feed for those
    values.
    Can anyone please help me how to give multiple delimiters for the same
    input flat file.
  2. dineshasanka Moderator

    I don't think you can give multiple demilaters.
    However, you can have two connections with one is tab seperator and the other is comma
    then merge these steams by using merge join.
  3. dineshasanka Moderator

    Sorry you can use script component to achive this with following script.
    Dim strRow As String
    Dim strColSeperator As StringDim rowValues As String()
    strRow = Row.Line.ToString()
    If strRow.Contains(",") ThenstrColSeperator = (",")
    ElseIf strRow.Contains(";") ThenstrColSeperator =
    ";"
    End IfrowValues = Row.Line.Split(CChar(strColSeperator))
    Row.Code = rowValues.GetValue(0).ToString()
    Row.Descrip = rowValues.GetValue(1).ToString()
    If you need a sample package, send me a mail to dineshasanka@gmail.com, I wil send the sample package.

Share This Page