At 1:25 PM -0500 8/7/01, [EMAIL PROTECTED] wrote:
>Hi All,
>
>Not sure if this is a bug or just a standard behavior of a auto_increment
>zerofill column.
>
>I have a column in a MySQL database table assigned as such:
>
>memid int(8) auto_increment zerofill primary key,
>
>now when the a new row is inserted in fills the column with the 
>appropriate 0's,
>but when I do a 'SELECT LAST_INSERT_ID()', after the insert, I get the last
>insert number, without the zeros, IE... Last inserted id value = 
>'00000012' but
>the return value is '12' and if I do a SELECT * FROM table_name WHERE memid =
>'12'; or SELECT * FROM table_name WHERE memid = '00000012';
>
>I get the same results, whether I use '12' or '00000012'
>
>Is this suppose to do that?? Just curious :)


LAST_INSERT_ID() returns a function value, not a table column value.
To get the result you want, you could use LPAD(LAST_INSERT_ID(),8,'0').

-- 
Paul DuBois, [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to