September 26, 2011 at 8:26 pm
Hi,
I have a spreadsheet that I am using as a source . I have some fields like productAmt that is varchar(20) in the destination table .
I am doing (DT_WSTR,30)(DT_NUMERIC,12,4)[ ProductPrice]
or
(DT_WSTR,30)(DT_DECIMAL,4)[ ProductAmt]
It is not pulling the values correctly for example ProductPrice is 3.4444 . but it inserts as 3.4443
ProductAmt = 1.19 but its inserted as 1.18 . But for some values its inserting correctly .
Please help .
September 27, 2011 at 7:04 am
stick with DT_NUMERIC, since it allows you to set the precision and scale.
Try changing it to (DT_NUMERIC,13,5), or more decimal places, cast it to a string ,and then substring to remove the extra decimals if you don't want them, and you don't want them to be rounded.
September 27, 2011 at 9:37 am
PSB (9/26/2011)
Hi,I have a spreadsheet that I am using as a source . I have some fields like productAmt that is varchar(20) in the destination table .
I am doing (DT_WSTR,30)(DT_NUMERIC,12,4)[ ProductPrice]
or
(DT_WSTR,30)(DT_DECIMAL,4)[ ProductAmt]
It is not pulling the values correctly for example ProductPrice is 3.4444 . but it inserts as 3.4443
ProductAmt = 1.19 but its inserted as 1.18 . But for some values its inserting correctly .
Please help .
Since your destination column is a varchar, I would suggest that you do not perform the numeric conversion at all. Rather do that after the fact when the data is alreay in the destination table, and when you plan on using it further.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply