Page 1 of 1

Decimal fields are putting a leading space by default

Posted: Thu Nov 09, 2006 4:29 pm
by shilpa79
Its a decimal field with (10,2). I want to remove the spaces inbetween them
Sample data:
2006093033 001 0000000000.00 0002055498.78 0000018615.46
2006093061 001 0000000000.00 0000000000.00 0000801466.59
2006093062 001 0000000000.00 0000000329.00 0000216546.21
2006093033 002 0000000000.00 0000166177.06 0000000173.07
2006093061 002 0000000000.00 0000021250.35 0000053596.18
2006093062 002 0000000000.00 0000000018.03 0000036382.91

Posted: Thu Nov 09, 2006 4:41 pm
by narasimha
Can you give an sample of how your output data should look?

Posted: Thu Nov 09, 2006 4:43 pm
by shilpa79
decimal fields are putting a leading space by default.
The data should look like this:
20060930none33none002none00000000.0000none00166177.0598none0000173.071

Posted: Thu Nov 09, 2006 5:37 pm
by narasimha
Finally I fished out the input that relates to your output

Input

Code: Select all

2006093033 002 0000000000.00 0000166177.06 0000000173.07 
Output

Code: Select all

20060930none33none002none00000000.0000none00166177.0598none0000173.071


I dont see a direct way of getting to your output

What are the rule for your transformation? More information please.

Posted: Thu Nov 09, 2006 5:52 pm
by shilpa79
Thanks for the result but my questionis how to remove the default leading space that it puts for the decimal fields
I was using none for testing

Posted: Thu Nov 09, 2006 6:11 pm
by ray.wurlod
The leading space is for the sign character. You can only remove it by converting the data type to VarChar and applying a function such as TrimF to it.

Posted: Thu Nov 09, 2006 6:21 pm
by shilpa79
It worked ray :D .

Thanks a lot for all your help.

Posted: Thu Nov 09, 2006 6:23 pm
by Dsnew
shilpa79 wrote:It worked.

Thanks a lot for your help.

Can you please let everyody know, how you solved it?

Posted: Thu Nov 09, 2006 6:26 pm
by shilpa79
I have changed the sqltype to varchar and used the function in the col derivation Decimaltostring