Problem in Converting NVarChar(17) to Numeric(13,3)
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 99
- Joined: Mon Sep 03, 2007 7:49 am
- Location: Stockholm, Sweden
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
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
String(NVarChar) to Decimal(Numeric) conversion successful
Hi Stefanstefanfrost1 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
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
Software Engineer