SSIS: Convert Numeric to Int
hi there,
im moving data from db2 to sql. at some situation numeric(13,0) not working so, in destination table i changed the datatype to int (but source its numeric(13,0).
so, on SSIS i cant map these columns so, i have to convert numeric(13,0) into int using Data Convert operator so, what is the equivalent type of numeric in SSIS. i tried with DT_i1, DT_i2,DT_i4 but no use.
experts please help me.Thanks In Advance, Jeyaseelan
October 11th, 2011 5:58am
DB2 Numeric should works be compatible with SQL Numeric.. Strange that it isnot working for you.. I have used it quite a lot and never had an issue.
When u map the Numeric Col, do you see any warning msg. Could you paste that here?Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
October 11th, 2011 6:11am
DB2 Numeric should works be compatible with SQL Numeric.. Strange that it isnot working for you.. I have used it quite a lot and never had an issue.
When u map the Numeric Col, do you see any warning msg. Could you paste that here?
Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/
Rahul thanks for your response,
in my situation i want to add/update the data to destination. both(source & destination) ID columns are numeric(13,0) that time flow always went to "No Match" and its not coming to
Match Output so, for testing purpose i changed to Int in both places after that its working fine.
so, that i can change the data type in destination table as int but i cant in source. now i want to convert from numeric(13,0) to int. now guide me how to do this?Thanks In Advance, Jeyaseelan
October 11th, 2011 6:28am
As i understand you mean to say that there is no problem in inserting DB2 numeric(13,0) to SQL Numeric(13,0) column .
But the problem is when u compare(may be using look-up) those two columns in SSIS, they dont match.
Is that you mean to ask?Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
October 11th, 2011 6:43am
As i understand you mean to say that there is no problem in inserting DB2 numeric(13,0) to SQL Numeric(13,0) column .
But the problem is when u compare(may be using look-up) those two columns in SSIS, they dont match.
Is that you mean to ask?
Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/
perfect 100% you understood my porblem.
could you please tell me what is the solution of this? else without chaging the data type is there anyway to workuot add & update?Thanks In Advance, Jeyaseelan
October 11th, 2011 6:49am
Okay, I dont know why DB2 Numeric and SQL Numeric values are not matching, to me they should match in SSIS too.And i cant test it right now
Any way if you are okay with int, then convert you Numeric(13,0) columns to Eight-byte integer in SSIS using
DataConversion transformation, This will create a new column as "Copy of NumericColumn". Now you can use them for you matching.
Below is snapshot from Data Conversion Transformation where n was my numeric(13,0)
you can use Dataviewer>grid to see the values with running the package.
one more thing to note here is Numeric(x,0) is a number which doesnt have any number after decimal point,so as good as Integer /big Int.
Hope this should solve your problem.Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
October 11th, 2011 7:05am
Thank you Rahul,
so, i added data convert and there i converted into eight byte unsigned integer then from Lookup i tried to map the columns but it says
Cannot map the input column, 'EMPID', to the lookup column, 'empid', because the data types do not match.
so i tried with copyofEmpid column also but getting the same error
here is my entire flow
OledbSource
Data Conversion
LookUp
|
|
|
|
OledbDestination OledbCommand
please help me how to resolve this.Thanks In Advance, Jeyaseelan
October 11th, 2011 7:50am
now i used four bytes signed integer for data conversion now its accepting and i can map EMPID(souce) and empid(destination) its fine but when press F5 im getting error as below
TITLE: Package Validation Error
------------------------------
Package Validation Error
------------------------------
ADDITIONAL INFORMATION:
Error at Data Flow Task [Lookup [214]]: input column "EMPID" (342) and reference column named "empid" have incompatible data types.
Error at Data Flow Task [SSIS.Pipeline]: "component "Lookup" (214)" failed validation and returned validation status "VS_ISBROKEN".
Error at Data Flow Task [SSIS.Pipeline]: One or more component failed validation.
Error at Data Flow Task: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
------------------------------
BUTTONS:
OK
------------------------------
what it means? experts please help me.Thanks In Advance, Jeyaseelan
Free Windows Admin Tool Kit Click here and download it now
October 11th, 2011 8:10am
what is your Distination.EMPID datatype.
Now as we have converted Source.EMPID to 4-byte Int .. your Distination.EMPID should also be int.
if Distination.EMPID datatype is numeric than use
SELECT CONVERT (BIGINT, EMPID ) ,* from Distinationtable for lookup table.
it should not give you error.Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/
October 11th, 2011 8:30am
thank you Rahul,
what is your Distination.EMPID datatype.
Its int only.
Now as we have converted Source.EMPID to 4-byte Int .. your Distination.EMPID should also be int.
Yes but also having the same error. but i can see the mapped columns like below
Thanks In Advance, Jeyaseelan
Free Windows Admin Tool Kit Click here and download it now
October 11th, 2011 9:02am
yahooo...finally i resolved this issue. i just delete lookup and re-create and problem resolved. thank you rahul .Thanks In Advance, Jeyaseelan
October 11th, 2011 9:13am