Use the Transact-SQL function TRY_CONVERT (Transact-SQL) to surpress/ignore conversion failures.
How to fix data convertion error from string value to int in ssis
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 ?
2 answers
Sort by: Most helpful
-
-
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.