How to fix data convertion error from string value to int in ssis

AvijitSwarnakar-5337 0 Reputation points
2023-09-20T17:25:25.2733333+00:00

Currently, I am working on a task where I am using the "SSIS Integration Toolkit for Microsoft Dynamics 365" to fetch data from online dynamic CRM source and populate this to on prem CRM database(just a copy activity).

I am using dynamic crm source to pull data using "SSIS Integration Toolkit for Microsoft Dynamics 365" choosing source entity.

All records from this entity should be copied to on prem CRM database(destination).

But the problem here is source column from source entity has data type nvarchar(64) and destination on prem database column has int data type.

I have to change the source nvarchar value to int actually. So I am using a derived column to do this like the way in screenshot attached.

But after executing the package SSIS is throwing error like attached screenshot.

Considering my source column has various bad records and for those I want to populate database "NULL". It seems it is not going to the else part of the condition which is "NULL".

Is there any. change needed in the expression (see attached) to do the same ?

Could you please provide a solution for the same ?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,788 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,577 questions
SQL Server Migration Assistant
SQL Server Migration Assistant
A Microsoft tool designed to automate database migration to SQL Server from Access, DB2, MySQL, Oracle, and SAP ASE.
532 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 44,501 Reputation points
    2023-09-21T04:46:31.3933333+00:00

    Use the Transact-SQL function TRY_CONVERT (Transact-SQL) to surpress/ignore conversion failures.

    1 person found this answer helpful.
    0 comments No comments

  2. ZoeHui-MSFT 36,511 Reputation points
    2023-09-21T06:36:29.3066667+00:00

    Hi @Avijit Swarnakar,,

    Add (DT_I4) before your expression to convert the string to int.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


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.