Special characters cause me problem

  • Hi all,

    It took me days still didn't figure out the solution.

    Problem:

    SSIS package failed many times.

    Reason:

    data type conversion problem. I used the expression "01/01"+right(columnName,4) to make up a date. It is working fine even the columnName has null value. However, there are blanks in some of the columnName.

    At first i thought they are spaces, even using the expression substring(columnName,1,1)=" ", it won't return ture. So, i am guessing it contains special characters such as tab, etc. Of course, the expression "01/01"+right(columnName,4)" will have data conversion problem if columnName contains special characters.

    Question:

    How to detect special characters in SSIS expression lang? What is the proper solution to handle such situation?

    Thanks.

  • Howard Hung (11/17/2008)


    Hi all,

    Problem:

    SSIS package failed many times.

    Reason:

    However, there are blanks in some of the columnName.

    At first i thought they are spaces, even using the expression substring(columnName,1,1)=" ", it won't return ture.

    Hi,

    I don't think the column has special charecters.

    Try this out. I hope this time it works for blanks. I am using the same in one of my SSIS package.

    WHEN columnName<>'' THEN

    do the conversion

    ELSE

    CHARINDEX (' ',columnname) -- this will return charector position if the space is there in column. if not it will return 0

    End

    Thank You

  • Hi,

    I am not sure with this, but it might help you. Try changing the datatype of the column from Varchar to nvarchar. This might help.

    Raj

Viewing 3 posts - 1 through 2 (of 2 total)

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