problem with import data to sql server from csv files

  • Personally I would write an ActiveX script to parse the data into separate columns as part of the transformation process.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • This should do it, you may have to convert the values

    Function Main()

     sTemp = DTSSource("Col001")

     iThere = InStr(sTemp, ",")

     DTSDestination("Column1") = Left(sTemp, iThere - 1)

     sTemp = Mid(sTemp, iThere + 1)

     iThere = InStr(sTemp, ",")

     DTSDestination("Column2") = Left(sTemp, iThere - 1)

     sTemp = Mid(sTemp, iThere + 1)

     

     iThere = InStr(sTemp, ",")

     DTSDestination("Column3") = Left(sTemp, iThere - 1)

     sTemp = Mid(sTemp, iThere + 1)

     

     iThere = InStr(sTemp, ".")

     sValue = Replace(Left(sTemp, iThere), ",", "")

     sTemp = Mid(sTemp, iThere + 1)

     iThere = InStr(sTemp, ",")

     DTSDestination("Column4") = sValue & Left(sTemp, iThere - 1)

     sTemp = Mid(sTemp, iThere + 1)

     

     iThere = InStr(sTemp, ".")

     sValue = Replace(Left(sTemp, iThere), ",", "")

     sTemp = Mid(sTemp, iThere + 1)

     iThere = InStr(sTemp, ",")

     DTSDestination("Column5") = sValue & Left(sTemp, iThere - 1)

     sTemp = Mid(sTemp, iThere + 1)

     

     iThere = InStr(sTemp, ".")

     sValue = Replace(Left(sTemp, iThere), ",", "")

     sTemp = Mid(sTemp, iThere + 1)

     iThere = InStr(sTemp, ",")

     DTSDestination("Column6") = sValue & Left(sTemp, iThere - 1)

     sTemp = Mid(sTemp, iThere + 1)

     

     DTSDestination("Column7") = sTemp

     Main = DTSTransformStat_OK

    End Function

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Thanks David. That worked. Thanks for all your help

    Sridhar!!

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply