1
votes

I need a solution to convert list of nvarchar to int (or numerical).

Input number is range of 0-10 or null and its a null value not null string.

On SSIS I have an OLE DB Source with this information which is then passed into a data conversion where this field is alterd to numeric (DT_NUMERIC), the destination table is set to receive an int however I always get the below error

"Data conversion failed while converting column Range to column numRange.The value could not be converted because of a potential loss of data"

I can ignore this and everything seems to work fine but I would rather either handle the error or figure out what's causing it, with this input data what is the issue?

1

1 Answers

0
votes

In a derived column component create a new column with expression as: (DT_I4)[Nvarchar column name].

Also, configure the error op to redirect row so that any failed conversions can be captured and fixed.

Refer to link : https://social.msdn.microsoft.com/Forums/en-US/705fa9a1-b7bc-402b-90cd-9ab67a278cff/converting-nvarchar-to-an-int-int-ssis?forum=sqlintegrationservices

https://social.technet.microsoft.com/Forums/sqlserver/en-US/baaecc68-54a2-496c-81a4-4cb4e897a9dc/convert-nvarchar-to-integer-in-sql-server?forum=sqldataaccess