Problem in Converting NVarChar(17) to Numeric(13,3)

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

stefanfrost1
Premium Member
Premium Member
Posts: 99
Joined: Mon Sep 03, 2007 7:49 am
Location: Stockholm, Sweden

Post by stefanfrost1 »

in your example the negation mark (-) is at the end of the string. Try flipping it to the front of the string, or just remove it and add if after conversion via a mathematical function
-------------------------------------
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
Mukti
Participant
Posts: 9
Joined: Tue Feb 06, 2007 11:08 pm

String(NVarChar) to Decimal(Numeric) conversion successful

Post by Mukti »

stefanfrost1 wrote:in your example the negation mark (-) is at the end of the string. Try flipping it to the front of the string, or just remove it and add if after conversion via a mathematical function
Hi Stefan

Thanks for your suggestion. I worked on that and got the solution.
I have used some transformation for converting that column value from string more specifically from NVarChar to Decimal. Now proper data is loading including negative values.

Below is the code:

If Index(TrimLeadingTrailing(ext_s_e_b_item.SYSTEM_CALCULATED_OPENING_BALANCE) ,"-",1) >0 Then StringToDecimal("-" : (Trim(Trim(ext_s_e_b_item.SYSTEM_CALCULATED_OPENING_BALANCE,"-","T") ,"0","L")))Else StringToDecimal(Trim(ext_s_e_b_item.SYSTEM_CALCULATED_OPENING_BALANCE,"0","L"))
Muktiasha
Software Engineer
Post Reply