Pad the leading zeros
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Pad the leading zeros Expand / Collapse
Author
Message
Posted 5/21/2009 12:44:34 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/10/2009 5:41:44 AM
Posts: 1, Visits: 5
Hi
I have the requirement in my project, i need to pad the leading zeros to the account number. to make the account number length equal to 10+ one space at first place.

Condition Source Value Source Value Result
CLNT_I 0000000123
CLNT_I=10(without sign) 1234567890 1234567890
CLNT_I 0000000123
CLNT_I=10 (with sign) -1234567890 - 1234567890


Please let me know the function.

Thanks,
Manj




Thanks,
Manju
Post #15493
Posted 5/21/2009 1:38:26 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: PAC and SFT Members
Last Login: 9/9/2009 4:34:06 PM
Posts: 407, Visits: 889
CAST(CAST(CLNT_I AS FORMAT'-9(10)') AS CHAR(11))
Post #15496
Posted 10/3/2009 12:08:35 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/28/2009 2:45:46 PM
Posts: 1, Visits: 15
I have two fields that I need to pad leading zeros. One requires 12 digits with pad leading zeros, such as 001123456789. The other requires 10 digits with pad leading zeros, but last two are decimals, such as 000001000. Here is my line of code. I can't tweak the code in the first line to work for 12-digit. when I changed from '9(10)' to '12(13)' I got invalid error message. The second line of code did not return pad leading zeros. What is wrong here.

CAST(CAST(acct_id '9(10)') AS CHAR(12)) ,
amt_due (decimal(11,2), format '$$$,$$$,$$9.99')

Thanks for any helps!
Sabrina
Post #17022
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 4:54pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.047. 8 queries. Compression Disabled.