Re: Re[2]: [PHP-DB] padding an id field

2001-10-04 Thread Raquel Rice

On Thu, 4 Oct 2001 14:17:22 -0300
WebDev <[EMAIL PROTECTED]> wrote:

> Thursday, October 04, 2001, 1:13:59 PM, you wrote:
> 
> RR> When you define your auto-incrementing column, can't you
specify
> RR> "ZEROFILL"?  I believe it pads to the left with zeroes.
> 
> Hello Raquel,
> 
> Yes, but is it possible to append a code such as 'abc' along with
the
> zerofill to create an id like 'abc000123' for the 123rd id record.
> 
> /Merle
> 

I don't believe that's a possibility.  However, if I were doing it
myself, I would have two columns ... one that contained the 'abc'
identifier (or whatever) and the second which contained the
auto-incremented ID.  Then when I retrieved the full ID, I would do
it using ...

SELECT concat(first_id,auto_id) AS full_id FROM id_table ORDER BY
full_id;

-- 
Raquel

Don't be afraid of opposition. Remember, a kite rises against ...
not with ... the wind.
  --Hamilton Mabie

  
  

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] padding an id field

2001-10-04 Thread WebDev

Is there anyway to pad an id field in MySQL?  I have a table with a PK
field (id).  This field is auto incrementing a 6 digit number ie.
000223.  Is there anyway to pad this id so that it is padded with a
code along with the auto incrementing part, such as ABC000223.  Now I
wouldn't want the ABC pad to change but the 6 digits would still auto
incr as required.

Is this possible without doing any field editing, exclusively with a
MySQL utility?

thanks
/Merle



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]