Padding Numeric field with leading Zeros #2

Hi,

I have a situation where I need to convert an Amount field into a CHAR 
field and pad it with leading Zeros, so that the total number of places 
occupied are 12 characters.

for example :

If the amount is $4.50

Then it should be converted as 

000000000450

Has anyone done this in the past. If yes, could you please send me the 
methodology. Thanks.

Regards,

Murali.
0
Murali_Krishnamurthy
7/9/2003 8:47:26 PM
sybase.ase.general 8655 articles. 0 followers. Follow

0 Replies
971 Views

Similar Articles

[PageSpeed] 55
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

Padding Numeric field with leading Zeros
Hi, I have a situation where I need to convert an Amount field into a CHAR field and pad it with leading Zeros, so that the total number of places occupied are 12 characters. for example : If the amount is $4.50 Then it should be converted as 000000000450 Has anyone done this in the past. If yes, could you please send me the methodology. Thanks. Regards, Murali. declare @VALUE int declare @i int select @i = 9 -- number of characters desired select @VALUE = -12345 /* leading sign */ SELECT CASE WHEN @VALUE >= 0 THEN "+" + r...

Storing values with more than 2 decimal places in a NUMERIC(9,2) field
With Interbase 7.5.1 I recently found that dbExpress (Delphi 7.1) allows to store more than two decimal places in a column which is defined as NUMERIC(9,2). Is this known behaviour? A related problem with dbExpress in Delphi is, that a record who uses more than 2 decimal places in this DECIMLA(9,2) column can not be edited in a data entry form which uses TSQLQuery and TClientDataSet: the ApplyUpdates method will fail with "record not found or modified by an other user". Best Regards -- Michael Justin SCJP, SCJA betasoft - Software for Delphi™ and for the Java™ ...

How to pad string with leading zeroes
*** please ignore the post entitled 'Brian'. Its a duplicate of *** this post without a matching title Hi, I have a requirement to convert a 3-digit integer to a 3 character string padded with leading zeroes as I SELECT it from the database. Examples: ========= 1 converts to '001' 21 converts to '021' 321 converts to '321' I have played with several string functions to no avail. Any help/suggestions would be appreciated. Brian Two possible ways to get you going: select substring(convert(char(4),column + 1000),2,3) OR ...

Pad Number with Leading Zeros
------_=_NextPart_001_01C146C3.16F952D0 Content-Type: text/plain; charset="iso-8859-1" Hello. Is there a way to pad a number with leading zeros with 1 command rather than the 2 I used below? It looks like you're supposed to be able to zero-fill with sprintf but I couldn't figure it out. #!/bin/perl -wd $f = 1234; $g = sprintf "%6s", $f; $g =~ s/ /0/g; print "$f\n"; print "$g\n"; ~Carl ------_=_NextPart_001_01C146C3.16F952D0-- ------_=_NextPart_001_01C146C7.025BA040 Content-Type: t...

Removing Leading Zeros #2
Hi all, I have sucked two substrings into two variables : $index = substr $_, 35, 11; $value = substr $_, 64, 6; These variables may or may not have leading zero/s : 000009/000099/000999........ and so on. If they do I need to strip away the leading zeros. Any ideas? Mark On Thu, 19 Apr 2001, Mark Martin wrote: > Hi all, > I have sucked two substrings into two variables : > > $index = substr $_, 35, 11; > $value = substr $_, 64, 6; > > These variables may or may not have leading zero/s : > > 000009/000099/000999........ and...

SQLRemote Problem with 7.0.2-1 and 6.0.2-1 on Linux [ASE 11.9.2-3 and ASE 12.5 eval]
Hi all I got the following problems using sql-remote. on ASE 12.5 eval: I got the following RPMs installed on RedHat Linux 7.2 - Kernel 2.4.17 - glibc-2.2.4 sybase-ase-12.5-3.i386.rpm sybase-common-12.5-3.i386.rpm sybase-openclient-12.5-3.i386.rpm sybase-sqlremote-7.0.2-1.i386.rpm After the execution of ssxtract or ssremote I got an error like: ../ssxtract: /opt/sybase-12.5/SQLRemote/lib/libsstasks7_r.so: version `libdbtasks7_r.so' not found (required by ./ssxtract) The file libsstasks7_r.so exists and the path is correctly specified in /etc/ld.so.conf. There'...

Remove trailing zeros in numeric fields.
Some fields in my datagrid are bound to numeric fields in the SqlServer database. The default behavior is that the datagrid always displays numbers to the same precision as the database field. But I get trailing zeros. How can I format the datagrid just to display the significant digits? Hi, in BoundField, add this property: DataFormatString = "{0:F2}"You can see more in : http://msdn2.microsoft.com/en-us/library/dwhawy9k.aspx ---Eduardo DiasMCP, MCTS Web ApplicationsACM Professional MemberCSTA Individual MemberIASA Individual Member--------------------------------...

Output numeric column with leading zeros
I need to output two columns from a certain table in a fixed column width format to a text file. The string column is no big deal--it was covered in documentation. However, I can't figure out how to export a numeric column with forced size that may include leading/trailing zeros if necessary. How can I do that? The existing column formats are: varchar(18), numeric(7.1) I need output to a text file similar to: CCCCCCCNNNNNNN.N (no delimiter, number may need leading zeros) Please respond in email if possible. Virtually yours, <orlan@hyperautomation.com> ...

csv insert leading zeros #2
--00151750eeba54f7a6046540ac10 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I'm sorry to have disturbed you. I was using a spreadsheet program to view the output instead of a text editor. I should know better. -Zenko -- I would rather be exposed to the inconveniences attending too much liberty than to those attending too small a degree of it. - Thomas Jefferson --00151750eeba54f7a6046540ac10-- ...

[Help]bcp_out a numeric field.. #2
Hi,everyone. How can I bcp_out a NUMERIC field using DB-Library?? I set file_type parameter "0" for this field. But encounterd "Unknown datatype" errors.. So, I tried like this. DBINT rowsread; char *term = "\0"; DBTYPEINFO typeinfo; typeinfo.precision = 5; typeinfo.scale = 0; bcp_init(dbproc, "my_table", "my_file.dat",NULL, DB_OUT); bcp_columns (dbproc, 2); bcp_colfmt (dbproc,1,SYBCHAR, 0,20,(BYTE*)term,strlen(term),1); bcp_colfmt_ps(dbproc,2,SYBNUMERIC,...

Replace leading zeros in character field
How do i replace leading zeros in a character field in a datawindow Example : 00012345, i would like that to be displayed as 12345. Thanks for help If the field only contains numbers, you could use string(number('00012345')). Attached is a generic replace function ( I thik I got it from the Code example that ships with PB) -- Terry Dykstra (TeamSybase) http://powerbuilder.codeXchange.sybase.com/ http://casexpress.sybase.com/cx/cx.stm product enhancement requests: http://my.isug.com/cgi-bin/1/c/submit_enhancement "chidu" <schidura@gmail.com> wrote in...

numeric ddw with leading zeroes; is it possible?
we have a drop down datawindow whose purpose is to display a social security number. the social security number is numeric in the database. the problem occurs when a number with leading zeroes is entered into the field; they are trimmed off. an editmask of "000000000" in the child datawindow works fine, but seems impossible to have a dropdown edit style and editmask edit style at the same time. we have a work around involving two columns sitting on top of each other; the column on top is an editmask, the one below is a dropdown with just the arrow visible behind the...

Download Database from ASE 11.9.2 to ASE 11.0.2 ?
Dear All: We have a Sybase ASE11.9.2 on Window NT, and we already run some application on it about 6 months. Since the third party software we use cann't support ASE11.9.2, we must use ASE 11.0.2. Can we just backup the database of ASE11.9.2 then restore the backup database to ASE11.0.2 ? Has it any problem ? Or, We must do following procedure. 1) bcp out the data from ASE11.9.2 2) create the database on ASE11.0.2 3) bcp in the 1) data to ASE11.0.2 Can anyone tell me?? Teresa Young Teresa, The problem with dump and load is that the log format in 11.9.2 is much diff...

ASE 11.9.2 on Solaris 2.6 #2
What is the "minimum" EBF level for 11.9.2 on Solaris 2.6? Yann Courtel wrote: > > What is the "minimum" EBF level for 11.9.2 on Solaris 2.6? None. -am ...

Web resources about - Padding Numeric field with leading Zeros #2 - sybase.ase.general

Optimal asymmetric encryption padding - Wikipedia, the free encyclopedia
and subsequently standardized in PKCS#1 v2 and RFC 2437 . The OAEP algorithm is a form of Feistel network which uses a pair of random oracles ...

Clintonworld is centre of pocket padding universe
Clinton nostalgia is being replaced by Clinton neuralgia.

MP sorry for padding his resume
State Liberal MP David Southwick apologises for misleading personal information on his website.

Former treasurer Peter Costello warns tax reform hard without 'padding' in public opinion, more difficult ...
Peter Costello warns the Government tax reform will be difficult and that it may not have the political capital to pull it off.

Padding and the Contractor
If padding hours is a problem in Biglaw, imagine what would happen if you paid lawyers by the hour.

Contractor Accuses LA Times of Padding Circulation Figures
In 2007, the U.S. Attorney’s office in Brooklyn announced it was ceasing prosecution of Tribune publications Newsday and Hoy for padding circulation ...

That's Not Padding, My Resume's Just Fat
That's Not Padding, My Resume's Just Fat

Recalls: 2013 Ford C-Max Hybrid recalled over lack of roof padding
Filed under: Hybrid , Minivan/Van , Wagon , Recalls , Safety , Ford Ford is recalling 33,021 units of its 2013 C-Max Hybrid not equipped with ...

The truth behind padding your CV
When looking for a job, every little bit counts — as long as it’s true.

Rams, Edward Jones Dome Cover Concrete with Padding After Reggie Bush's Injury - Bleacher Report
On the heels of injuries suffered by San Francisco 49ers running back Reggie Bush and Cleveland Browns quarterback Josh McCown at the Edward ...

Resources last updated: 1/20/2016 5:58:58 AM