List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:October 12 2002 1:13am
Subject:Re: padding field with zeros
View as plain text  
See the ZEROFILL column attribute:

If necessary, you can use an ALTER TABLE command to add that 
attribute to the appropriate columns.

	- steve

At 10:11 AM -0700 10/11/02, Bryan Koschmann - GKT wrote:
>Does MySQL provide for any way to "pad" a field? I have accounts numbers
>that vary from 3-5 digits, and would like them 8 digits padded by zeros
>(479 becomes 00000479, 17234 becomes 00017234, etc). I know I could
>probably write a script to fix that before entering the data into the
>database, but I just wanted to know. Or maybe there is a way to pad it
>while doing the query select?
>	Bryan

| Steve Edberg                                      sbedberg@stripped |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin      |
| The end to politics as usual:                                          |
|                 The Monster Raving Loony Party ( |
padding field with zerosBryan Koschmann - GKT11 Oct
  • Re: padding field with zerosSteve Edberg12 Oct
  • Re: padding field with zerosPaul DuBois12 Oct