Page 1 of 2

To supress Zero in decimal colm

Posted: Fri May 22, 2009 4:12 am
by Suganya Vanjinathan
Hi ,


From source(teradata) I am extracting a decimal coln with datatype decimal(6) and putting it in to a text file with datatype(decimal(6)).My problem is ,for source value 500 i am getting output as [b]000500.[/b] (with the period). I dont know how to supress this zero and period. :( . if any body know how to resolve it.

Posted: Fri May 22, 2009 4:30 am
by Sainath.Srinivasan
Search for decimalToString

Posted: Fri May 22, 2009 4:51 am
by Suganya Vanjinathan
Supressed Zero as u said . But my target is Decimal. while inserting again i convert it in to string to decimal. still it is showing the same result.

Posted: Fri May 22, 2009 4:59 am
by priyadarshikunal
Does it matters if you are writing varchar(6) or Integer to the sequential file instead of decimal(6)?

Posted: Fri May 22, 2009 5:05 am
by Suganya Vanjinathan
Yes. Our client need it in that format :(

Posted: Fri May 22, 2009 5:20 am
by Sainath.Srinivasan
Is it fixed width or delimited output?

Posted: Fri May 22, 2009 5:22 am
by Suganya Vanjinathan
Delimited with ,

Posted: Fri May 22, 2009 5:23 am
by Sainath.Srinivasan
Then call it Varchar(6)

Posted: Fri May 22, 2009 5:30 am
by Suganya Vanjinathan
In client side they are loading it in to some other database.There it is like decimal (6). will it wont give problem if it varchar in file.

Posted: Fri May 22, 2009 5:39 am
by nagarjuna
I dont think it will make any difference since your source is a decimal .Also , there is an option called supress zero in the conversion function you can try with it and let us know if its working or not

Posted: Fri May 22, 2009 5:42 am
by Suganya Vanjinathan
I used That supress Zero option . It is working fine if the target is varchar.But my target coln is decimal(6)

Posted: Fri May 22, 2009 6:08 am
by Sainath.Srinivasan
Why don't you give it a try by making your output as Varchar(6) ?

Posted: Fri May 22, 2009 6:17 am
by priyadarshikunal
The decimal field will always have zero padded in front of the actual value to make it to defined length. You can't do anything with that. Changing it to VarChar(6) will not impact the other jobs reading this field as decimal(6) as the sequential file doesn't store the metadata and the value present in that field id numeric.

Posted: Fri May 22, 2009 6:48 am
by chulett
Exactly. You are trying to 'solve' a non-existent problem.

Posted: Fri May 22, 2009 6:53 am
by Suganya Vanjinathan
Thanks a lot every body