Forwarded to the list for the benefit of all...


Begin forwarded message:


From: "Mike Mapsnac" <[EMAIL PROTECTED]>
Date: 4 January 2004 15:42:33 GMT
To: [EMAIL PROTECTED]
Subject: Re: insert: auto increment field

I use both metods and they works But when I make another insert I receive a message
ERROR: 1062 Duplicate entry '2147483647' for key 1.


Why id (primaty , and auto increment) start from 2147483647 and not from 0 or 1

Thanks



From: Steve Folly <[EMAIL PROTECTED]>
To: MySQL MySQL <[EMAIL PROTECTED]>
Subject: Re: insert: auto increment field Date: Sun, 4 Jan 2004 15:27:47 +0000



On 4 Jan 2004, at 15:09, Mike Mapsnac wrote:


I have table with 7 fields. First field is id (auto increment). As I understand the value should start from 0 and next value will auto increment.

And I shouldn't add insert the value. So the insert
statemens below gives me an error. ERROR 1136:Column count doesn't match value count at row 1


insert into product values('456789','t1', 'new', 2, 2, 10);

Two options:


Use NULL as the value for the auto-increment column. (Probably the easiest method!)
(side note: you can then retrieve the real value with LAST_INSERT_ID() function)


Or, specify the column names in your query as well, so MySQL can tie up columns and values:

insert into product (col2, col3, col4, col5, col6) values('456789','t1', 'new', 2, 2, 10)

Without column names, it expects there to be values for all columns. So in your case, just don't specify the auto-increment column.


HTH Steve.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



_________________________________________________________________
Enjoy a special introductory offer for dial-up Internet access — limited time only! http://join.msn.com/?page=dept/dialup




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to