SSIS - Derived task expression help to check if numeric

Vishal Parikh 1 Reputation point
2020-09-07T13:01:05.123+00:00

hi all,

my data is coming from excel to sql via ssis package.

now in my excel , sometimes due to formula i am getting data like #ERROR,#DIV/O,-,N.A,n.a and etc..

Now i want to put condition that,If data is numeric then leave as it is and if it is not numeric then replace source value with db-null.

can you please help me for derived column expression.so,my pakage will not fail due to this string values.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,703 questions
SQL Server | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Monalv-MSFT 5,926 Reputation points
    2020-09-09T07:55:08.583+00:00

    Hi @VishalParikh-3429,

    According to my test, we can add Data Conversion and Derived Column in Data Flow Task.

    1.Add a Data Conversion to change the Data Type of column as DT_I4.
    2.Set the Configure Error Output in Data Conversion.
    3.Set the value of column in error data as NULL(DT_I4) in Derived Column.

    Please refer to the following pictures:
    23350-dataflow.png
    23327-excelsource.png
    23398-dataconversion.png
    23399-derivedcolumn.png
    23424-mapping.png
    23425-resultindestination.png

    Best Regards,
    Mona


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Guoxiong 8,206 Reputation points
    2020-09-07T14:57:24.653+00:00

    Try this:
    (DT_I4)YourField == (DT_I4)YourField ? (DT_I4)YourField : NULL(DT_I4)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.