Share via

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 Integration Services
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.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


2 answers

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

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

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. ZoeHui-MSFT 41,551 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.

    Was this answer helpful?


Your answer

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