Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

SSIS 2005: Find illegal delimiter in a string in script task

$
0
0

Hello,

I am loading a delimited text file into SQL Server 2005.

It is a pipe (|) delimited text file.

I have a flat file source.

I have a script task as a transformation.

I have an OLE DB sql destination.

There are 5 columns in the file. the file is pipe delimited.  All the columns are text.

Sometimes, I receive an error in the package because:

there is a pipe (|) character in one of the strings (column 4).

it causes the package to think that there are 6 columns, but there really isn't. It just that the file was sent with a delimited in one of the text columns.

My question is:

Is there a way to check the string and see if there is a delimiter in it and then replace it, instead of having the package FAIL.????????

I was trying to us IndexOf and Replace

Example:

If

Row.MyColumn_IsNull <> TrueThen

If (Row.MyColumn.IndexOf("|") = -1) Then

                Row.MyColumn = Trim(Row.MyColumn)

Else

Row.MyColumn = Trim(Replace(Row.MyColumn,

"|",""))

EndIf

Else


            Row.MyColumn_IsNull =

True

EndIf

Thanks.

           

          




Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>