Re: How to get auto Increment ID of INSERT?

2015-10-08 Thread Carsten Pedersen
(). Best, / Carsten On 08-10-2015 15:48, Richard Reina wrote: If I insert a record into a table with an auto increment ID how can I get that records ID value? I have read about SELECT LAST_INSERT_ID() statement, however, do not two statements introduce the risk that another insert may occur

How to get auto Increment ID of INSERT?

2015-10-08 Thread Richard Reina
If I insert a record into a table with an auto increment ID how can I get that records ID value? I have read about SELECT LAST_INSERT_ID() statement, however, do not two statements introduce the risk that another insert may occur in the interum? Is there a full proof way of getting the ID

Re: auto-increment more than one field

2013-05-14 Thread Jan Steinman
From: rounak jain rounak.m...@gmail.com I have a table which needs two fields with auto-increment. I don't know if you have such control over your installation, but you might consider the work-alike MariaDB, which I believe supports auto-increment on multiple fields, as well as a slew

Re: auto-increment more than one field

2013-05-12 Thread Michael Dykman
refer to http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html On Sun, May 12, 2013 at 9:39 AM, rounak jain rounak.m...@gmail.com wrote: I have a table which needs two fields with auto-increment. I have the found the answer here: http://stackoverflow.com/questions/13642915/mysql

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-16 Thread Hank
are reported on the slave. -Hank Eskin On Wed, Jun 15, 2011 at 4:38 PM, Hank hes...@gmail.com wrote: This is a follow-up to my previous post. I have been narrowing down what is causing this bug. It is a timing issue of a replication ignored table with an auto-increment primary key

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Claudio Nanni
causing it. I plan to write it up tomorrow and post it. Basically, everything works perfectly, until I add a replication-ignore-table=xxx statement in my.cnf where xxx is a different table with a unique id INT auto-increment as the single primary key And then the values being inserted

Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Hank
This is a follow-up to my previous post. I have been narrowing down what is causing this bug. It is a timing issue of a replication ignored table with an auto-increment primary key values leaking over into a non-ignored table with inserts immediately after the ignore table has had rows inserted

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Hank
are reported on the slave. -Hank Eskin On Wed, Jun 15, 2011 at 4:38 PM, Hank hes...@gmail.com wrote: This is a follow-up to my previous post. I have been narrowing down what is causing this bug. It is a timing issue of a replication ignored table with an auto-increment primary key values

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Claudio Nanni
...@gmail.com wrote: This is a follow-up to my previous post. I have been narrowing down what is causing this bug. It is a timing issue of a replication ignored table with an auto-increment primary key values leaking over into a non-ignored table with inserts immediately after the ignore

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Hank
15, 2011 at 4:38 PM, Hank hes...@gmail.com wrote: This is a follow-up to my previous post. I have been narrowing down what is causing this bug. It is a timing issue of a replication ignored table with an auto-increment primary key values leaking over into a non-ignored table

Re: Found serious replication data-corruption bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-15 Thread Claudio Nanni
down what is causing this bug. It is a timing issue of a replication ignored table with an auto-increment primary key values leaking over into a non-ignored table with inserts immediately after the ignore table has had rows inserted. Basically, data from the ignored table

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Claudio Nanni
master, and this bug appears on both 5.5.11 and 5.5.8 32 and 64-bit slaves (statement based replication). I'm finding an auto-increment field (part of a compound primary key) updates correctly using null to insert the next value on the master.. but when this statement is replicated

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Hank
5.5.11 and 5.5.8 32 and 64-bit slaves (statement based replication). I'm finding an auto-increment field (part of a compound primary key) updates correctly using null to insert the next value on the master.. but when this statement is replicated on the slaves, instead of inserting

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Hal�sz S�ndor
2011/06/13 22:38 -0400, Hank But that bug report was closed two years ago. I have no idea if it's the server sending bad data or the slaves. I think it's the slaves, because on the slave error, it clearly is getting this statement: insert into test values (1,null) to replicate, but when it is

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Hank
, until I add a replication-ignore-table=xxx statement in my.cnf where xxx is a different table with a unique id INT auto-increment as the single primary key And then the values being inserted into the test table (above, not ignored) represent the last-insert-id of the replication *ignored* table

Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Hank
Hello All, I have a 64bit, 5.5.8 master, and this bug appears on both 5.5.11 and 5.5.8 32 and 64-bit slaves (statement based replication). I'm finding an auto-increment field (part of a compound primary key) updates correctly using null to insert the next value on the master.. but when

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Claudio Nanni
a 64bit, 5.5.8 master, and this bug appears on both 5.5.11 and 5.5.8 32 and 64-bit slaves (statement based replication). I'm finding an auto-increment field (part of a compound primary key) updates correctly using null to insert the next value on the master.. but when this statement is replicated

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Hank
On Jun 14, 2011 3:07 AM, Hank hes...@gmail.com wrote: Hello All, I have a 64bit, 5.5.8 master, and this bug appears on both 5.5.11 and 5.5.8 32 and 64-bit slaves (statement based replication). I'm finding an auto-increment field (part of a compound primary key) updates correctly

Re: Found a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-13 Thread Hank
. Claudio On Jun 14, 2011 3:07 AM, Hank hes...@gmail.com wrote: Hello All, I have a 64bit, 5.5.8 master, and this bug appears on both 5.5.11 and 5.5.8 32 and 64-bit slaves (statement based replication). I'm finding an auto-increment field (part of a compound primary key) updates

[setting value when INSERT for auto increment]

2011-05-16 Thread Grega Leskovšek
Should it be null? INSERT INTO `friendlyCMS`.`log` (`idlog`, `imepriimek`, `clock`, `action`, `onfile`, `filesize`) VALUES (NULL, $_COOKIE['user'], CURRENT_TIMESTAMP, 'saved',$filename, filesize($filename)); idlog is primaryk ey auto inrement not null... When insertin the value what should I pass

Re: [setting value when INSERT for auto increment]

2011-05-16 Thread Johan De Meersman
when INSERT for auto increment] Should it be null? INSERT INTO `friendlyCMS`.`log` (`idlog`, `imepriimek`, `clock`, `action`, `onfile`, `filesize`) VALUES (NULL, $_COOKIE['user'], CURRENT_TIMESTAMP, 'saved',$filename, filesize($filename)); idlog is primaryk ey auto inrement not null... When

Re: [setting value when INSERT for auto increment]

2011-05-16 Thread Basil Daoust
To: mysql@lists.mysql.com Sent: Monday, 16 May, 2011 4:49:43 PM Subject: [setting value when INSERT for auto increment] Should it be null? INSERT INTO `friendlyCMS`.`log` (`idlog`, `imepriimek`, `clock`, `action`, `onfile`, `filesize`) VALUES (NULL, $_COOKIE['user'], CURRENT_TIMESTAMP, 'saved',$filename

Auto-Increment Values in Mysql

2011-02-09 Thread Adarsh Sharma
Dear all, I have an auto-increment column in Mysql database table. Let's say the column has below values : 1 2 3 4 5 6 7 8 9 10 Now if i deleted some rows where id= 3 ,5 and 8 The data look like as : 1 2 4 6 7 9 10 I want to have it id's as 1 2 3 4 5 6 7 and next data is inserted right

Re: Auto-Increment Values in Mysql

2011-02-09 Thread Mark Goodge
On 09/02/2011 11:41, Adarsh Sharma wrote: Dear all, I have an auto-increment column in Mysql database table. Let's say the column has below values : 1 2 3 4 5 6 7 8 9 10 Now if i deleted some rows where id= 3 ,5 and 8 The data look like as : 1 2 4 6 7 9 10 I want to have it id's as 1 2

Re: Auto-Increment Values in Mysql

2011-02-09 Thread Reindl Harald
* there are bookmarks out there * they NEVER should point to another product what costs 5.000 $ as sample in no rdbms auto_increment values are reused and if than you have found a hard bug Am 09.02.2011 12:41, schrieb Adarsh Sharma: Dear all, I have an auto-increment column in Mysql database table

Re: Auto-Increment Values in Mysql

2011-02-09 Thread Jan Steinman
From: Adarsh Sharma adarsh.sha...@orkash.com I have an auto-increment column in Mysql database table. Let's say the column has below values : I'll echo what others have said. Auto-increment is typically used to generate unique primary keys. If this column is your primary key, DO

RE: INSERT with auto increment

2010-07-01 Thread David Stoltz
Awesome - thanks all for that clarification! -Original Message- From: Michael Dykman [mailto:mdyk...@gmail.com] Sent: Wednesday, June 30, 2010 1:42 PM To: David Stoltz Cc: mysql@lists.mysql.com Subject: Re: INSERT with auto increment generally, it is: INSERT INTO TABLE1 (fieldname

INSERT with auto increment

2010-06-30 Thread David Stoltz
Hi All, In MS SQL, if the table has an identity field/primary key which is set to auto increment, you can leave the value out of an INSERT statement, and the next highest value will be automatically inserted... For instance, with a two column table I could do INSERT INTO TABLE1 VALUES

Re: INSERT with auto increment

2010-06-30 Thread Michael Dykman
-increment will engage on an insert of 0 - michael dykman On Wed, Jun 30, 2010 at 1:30 PM, David Stoltz dsto...@shh.org wrote: Hi All, In MS SQL, if the table has an identity field/primary key which is set to auto increment, you can leave the value out of an INSERT statement, and the next highest

Re: INSERT with auto increment

2010-06-30 Thread Jo�o C�ndido de Souza Neto
, if the table has an identity field/primary key which is set to auto increment, you can leave the value out of an INSERT statement, and the next highest value will be automatically inserted... For instance, with a two column table I could do INSERT INTO TABLE1 VALUES('stuff') I'm having trouble

Re: INSERT with auto increment

2010-06-30 Thread Jan Steinman
From: David Stoltz dsto...@shh.org In mySQL, if I expressly give it a value, like INSERT INTO TABLE1 VALUES(17,'stuff') - it works fine. But if I remove the 17, it says I don't have a matching number of columns. Use NULL for the autoinsert column. I made it a rule to forbear

Re: Auto Increment in InnoDB

2010-04-23 Thread Johan De Meersman
It might also be done by keeping a last-revision table. Then you'd only select 1 record from that, and up the number. On Thu, Apr 22, 2010 at 5:34 PM, Chris W 4rfv...@cox.net wrote: Johan De Meersman wrote: On Thu, Apr 22, 2010 at 1:34 PM, Carsten Pedersen cars...@bitbybit.dk wrote:

Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
I have a InnoDB table which contains columns named 'cluster' and 'file' ('cluster' + 'file' is a primary key). I want to add a new column that tracks the revision number of a file for a given cluster and a file. The situation is tailor made for a MyIsam table where I can add a new Auto

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
that tracks the revision number of a file for a given cluster and a file. The situation is tailor made for a MyIsam table where I can add a new Auto Increment column as a secondary column in a multiple column index. How can I get the same behavior in an InnoDB table? Given below is a view of how

Re: Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
for a MyIsam table where I can add a new Auto Increment column as a secondary column in a multiple column index. How can I get the same behavior in an InnoDB table? Given below is a view of how the records will look like

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
On Thu, Apr 22, 2010 at 12:09 PM, Aveek Misra ave...@yahoo-inc.com wrote: I am not sure I understand. If I make the autoincrement column as part of the primary key as (rev + cluster + file), how do I ensure that a reset of the revision number is done as soon as (cluster + file) combination

Re: Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
MyISAM has this really cool feature where you can specify autoincrement on a secondary column in a multiple column index. In such a case the generated value for the autoincrement column is calculated as MAX(autoincrement column) + 1 WHERE prefix='given-prefix'. For more refer to

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
Kudos for managing to drag up such an obscure piece of functionality :-) I can see where it would be useful, though. As to your question, though: given that that page indicates that it will reuse deleted sequence numbers, I think your best bet would be select @id := count(*)+1 from table where

Re: Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
How can count(*) in an InnoDB table be faster than MAX() considering that the former needs to do a table scan and the latter can use an index if correctly used? My code starts the sequence from 1. Thanks Aveek Johan De Meersman wrote: Kudos for managing to drag up such an obscure piece of

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
The count happens after the where on an index - it should just count the appropriate index rows without looking at the values. Worth benchmarking on your dataset, though. On Thu, Apr 22, 2010 at 1:22 PM, Aveek Misra ave...@yahoo-inc.com wrote: How can count(*) in an InnoDB table be faster than

Re: Auto Increment in InnoDB

2010-04-22 Thread Carsten Pedersen
On Thu, 22 Apr 2010 13:12:16 +0200, Johan De Meersman vegiv...@tuxera.be wrote: Kudos for managing to drag up such an obscure piece of functionality :-) I can see where it would be useful, though. As to your question, though: given that that page indicates that it will reuse deleted

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
On Thu, Apr 22, 2010 at 1:34 PM, Carsten Pedersen cars...@bitbybit.dkwrote: Wouldn't that strategy cause problems if one or more rows have been deleted in the meantime? (i.e. sequence numbers 1-4 have been created, row 2 has been deleted - new sequence number would be 4). Yeps. I'm none too

Re: Auto Increment in InnoDB

2010-04-22 Thread mos
for a MyIsam table where I can add a new Auto Increment column as a secondary column in a multiple column index. How can I get the same behavior in an InnoDB table? Given below is a view of how the records will look like | Cluster

Re: Auto Increment in InnoDB

2010-04-22 Thread Chris W
Johan De Meersman wrote: On Thu, Apr 22, 2010 at 1:34 PM, Carsten Pedersen cars...@bitbybit.dkwrote: Wouldn't that strategy cause problems if one or more rows have been deleted in the meantime? (i.e. sequence numbers 1-4 have been created, row 2 has been deleted - new sequence number would

Re: Table level locking when inserting auto-increment PK to InnoDB

2009-12-24 Thread Jaime Crespo Rincón
2009/12/23 Ryan Chan ryanchan...@gmail.com: Hey. Back to few years ago, InnoDB require table level locking when inserting auto-increment PK to the table, and Heikki said there will be a fix. Is this problem still exist now? If you refer to this bug: http://bugs.mysql.com/bug.php?id=16979

Table level locking when inserting auto-increment PK to InnoDB

2009-12-23 Thread Ryan Chan
Hey. Back to few years ago, InnoDB require table level locking when inserting auto-increment PK to the table, and Heikki said there will be a fix. Is this problem still exist now? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http

Auto Increment Problem

2009-12-05 Thread Victor Subervi
Hi; mysql insert into categories (Category, Parent) values ('test', NULL); ERROR 1062 (23000): Duplicate entry '0' for key 1 mysql describe categories; +--+-+--+-+-+---+ | Field| Type| Null | Key | Default | Extra |

Re: Auto Increment Problem

2009-12-05 Thread Victor Subervi
Oops. Never mind. V On Sat, Dec 5, 2009 at 1:19 PM, Victor Subervi victorsube...@gmail.comwrote: Hi; mysql insert into categories (Category, Parent) values ('test', NULL); ERROR 1062 (23000): Duplicate entry '0' for key 1 mysql describe categories;

Auto increment?

2009-04-02 Thread Andreas Pardeike
Hi, I have a table 'test' +-+--+--+-+--- ++ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+--- ++ | id | int(11) | NO

Re: Auto increment?

2009-04-02 Thread Steve Edberg
At 9:35 AM +0200 4/2/09, Andreas Pardeike wrote: Hi, I have a table 'test' +-+--+--+-+---++ | Field | Type | Null | Key | Default | Extra |

Re: Auto increment?

2009-04-02 Thread Scott Haneda
On Apr 2, 2009, at 12:51 AM, Steve Edberg wrote: At 9:35 AM +0200 4/2/09, Andreas Pardeike wrote: Hi, I have a table 'test' +-+--+--+-+--- ++ | Field | Type | Null | Key | Default | Extra |

Re: Auto increment?

2009-04-02 Thread Andreas Pardeike
Steve Scott, Thanks for the suggestions. The problem with a timestamp is that it's not fine granular. The consumer application can record last_poll_time and if it is X then either of the following will not work: 1) select * from table where tstamp = X - this fails because it will receive

Re: Auto increment?

2009-04-02 Thread Scott Haneda
I read your other replies about the timestamp not working. I still think adding the updated and created fields is a good idea in general, to any table. I have some questions about the below since the original suggestion would not work for you. On Apr 2, 2009, at 12:35 AM, Andreas

Setting auto increment value in an update statement

2009-03-31 Thread Andreas Pardeike
Hi, I have a table 'test' +-+--+--+-+--- ++ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+--- ++ | id | int(11) | NO

Auto increment without uniquness

2009-03-19 Thread Scott Haneda
I think ideally I would like to create an auto increment column that has no requirement for uniqueness. So if 6 was the last entry, and there are 10 of them, 7 would still be the next, is this possible? I am assuming it is not? I am working in a case where data is needing to be de

Re: [PHP] RE: non-auto increment question

2009-03-11 Thread PJ
looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session

Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session variable or (more easily) as a hidden field on your form. Thanks, Jerry

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
-Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Thursday, February 26, 2009 11:27 AM To: Jerry Schwartz Cc: a...@ashleysheridan.co.uk; 'Gary W. Smith'; 'MySql'; php- gene...@lists.php.net Subject: Re: [PHP] RE: non-auto increment question Jerry Schwartz wrote: Being

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query = INSERT INTO `another_table`(`link_id`,`value`) VALUES($autoId,'$value'); $result =

Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
Ashley Sheridan wrote: On Thu, 2009-02-26 at 13:44 -0500, Jerry Schwartz wrote: Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query =

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
Sorry, I should know better. -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Thursday, February 26, 2009 1:51 PM To: Jerry Schwartz Cc: 'PJ'; 'Gary W. Smith'; 'MySql'; php-gene...@lists.php.net Subject: RE: [PHP] RE: non-auto increment question On Thu

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Gary W. Smith
Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by

non-auto increment question

2009-02-25 Thread PJ
I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book

RE: non-auto increment question

2009-02-25 Thread Gary W. Smith
. From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-gene...@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value

Re: [PHP] RE: non-auto increment question

2009-02-25 Thread PJ
the same generated id. Hope that helps. From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-gene...@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest

RE: [PHP] RE: non-auto increment question

2009-02-25 Thread Jerry Schwartz
Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by

RE: [PHP] RE: non-auto increment question

2009-02-25 Thread Jerry Schwartz
/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS [JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field

reset auto increment to a lesser value

2008-08-02 Thread abhishek jain
Hello friends, I need to reset auto increment to a lesser value, is there a metod to do so in any version of mysql. Pl. help me. Thanks abhi

Re: reset auto increment to a lesser value

2008-08-02 Thread abhishek jain
auto increment to a lesser value, is there a metod to do so in any version of mysql. Pl. help me. Thanks abhi Hi Nacho, Thanks for the reply, But as per a thread on this link, if the resetted value is less than the highest value already in table then the effective increment value will start

Re: reset auto increment to a lesser value

2008-08-02 Thread Mark Goodge
to start from those row-ids. That can't be done. An auto-increment value must be higher than the highest existing value. Otherwise, it would not be an auto-increment value at all - it would be an auto-interpolate. On a more general note, if the actual value of the primary key matters for anything

Re: reset auto increment to a lesser value

2008-08-02 Thread Chris W
Mark Goodge wrote: On a more general note, if the actual value of the primary key matters for anything other than simply existing as a primary key, then you shouldn't be using auto-increment at all. You should generate the value through some other means and insert it with the value that you

Re: reset auto increment to a lesser value

2008-08-02 Thread Mark Goodge
Chris W wrote: Mark Goodge wrote: On a more general note, if the actual value of the primary key matters for anything other than simply existing as a primary key, then you shouldn't be using auto-increment at all. You should generate the value through some other means and insert

Re: Replication for auto-increment tables

2008-04-20 Thread Brent Baisley
If you are getting duplicate id's on the slave, then something is not setup correctly. The save should have the same ids as the master. Just because a field is auto-increment, doesn't mean you can't enter you own value. Think of auto-increment as a default value setting. Just because

Re: Replication for auto-increment tables

2008-04-20 Thread Chanchal James
advise. On Sun, Apr 20, 2008 at 11:01 AM, Brent Baisley [EMAIL PROTECTED] wrote: If you are getting duplicate id's on the slave, then something is not setup correctly. The save should have the same ids as the master. Just because a field is auto-increment, doesn't mean you can't enter you own

Replication for auto-increment tables

2008-04-18 Thread Chanchal James
duplicates, its just that its id on slave was already occupied by some previous entry!! I see mysql 5 has options like: auto-increment-increment auto-increment-offset , but with v4.1 Any help is appreciated. Thanks!

Reset a auto increment field?

2007-08-29 Thread Jason Pruim
Is there away to reset an auto incrementing field count? I have a database that currently has 935 records in it but because I have deleted a few the current number used for NEW records is 938 :) How can I get it to count the records and assign a record number based on the total count?

Re: Reset a auto increment field?

2007-08-29 Thread dpgirago
? Hope that makes sense! Thanks for looking! :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] AFAIK, you need to drop and then recreate the auto-increment field, otherwise you'll get holes when you delete

RE: Reset a auto increment field?

2007-08-29 Thread emierzwa
is not changed. Ed -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 29, 2007 11:02 AM To: Jason Pruim Cc: MySQL List Subject: Re: Reset a auto increment field? Is there away to reset an auto incrementing field count? I have a database

Re: Reset a auto increment field?

2007-08-29 Thread Jason Pruim
If I understand you correctly, if my table is MyISAM, after I did a delete query I could just: ALTER TABLE t2 AUTO_INCREMENT=1; and that would cause the auto increment value to be set to 901 (Assuming 900 total current records) on the next insert? On Aug 29, 2007, at 1:48 PM, [EMAIL

RE: Reset a auto increment field?

2007-08-29 Thread emierzwa
Yes, for a MyIsam type table. Ed -Original Message- From: Jason Pruim [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 29, 2007 11:53 AM To: emierzwa Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: Reset a auto increment field? If I understand you correctly, if my table

Re: Reset a auto increment field?

2007-08-29 Thread Shawn Green
Hi Jason, Jason Pruim wrote: Is there away to reset an auto incrementing field count? I have a database that currently has 935 records in it but because I have deleted a few the current number used for NEW records is 938 :) How can I get it to count the records and assign a record number

RE: Reset a auto increment field?

2007-08-29 Thread Jerry Schwartz
www.the-infoshop.com www.giiexpress.com www.etudes-marche.com -Original Message- From: Jason Pruim [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 29, 2007 1:53 PM To: [EMAIL PROTECTED]@micron.com Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: Re: Reset a auto increment field

Re: Reset a auto increment field?

2007-08-29 Thread Jason Pruim
On Aug 29, 2007, at 2:30 PM, Shawn Green wrote: Hi Jason, Jason Pruim wrote: Is there away to reset an auto incrementing field count? I have a database that currently has 935 records in it but because I have deleted a few the current number used for NEW records is 938 :) How can I get

Re: Reset a auto increment field?

2007-08-29 Thread Shawn Green
Jason Pruim wrote: snip I see what you are getting at with this, and have decided that mucking around with auto incrementing values doesn't exactly fit in with the way databases were designed to work. Somehow though, I still need to supply this whether I end up adding a Record number

RE: Reset a auto increment field?

2007-08-29 Thread Jerry Schwartz
Do you mean you want to be able to display the record number as sorted by the auto-increment field, rather than the auto-increment field itself? Or do you just want the total number of records? Or do you just want the highest current value of the auto-increment field? The latter two are easy

Re: auto increment format

2007-08-08 Thread Brent Baisley
. The downside is that all your queries (joins too) will need to reference 2 fields instead of 1. On Aug 7, 2007, at 8:05 AM, shivendra wrote: Hi, I'm looking for some basic help. I am developing a MySQL database and want to auto increment a field, but I don't want it to just count 1,2,3, etc

auto increment format

2007-08-07 Thread shivendra
Hi, I'm looking for some basic help. I am developing a MySQL database and want to auto increment a field, but I don't want it to just count 1,2,3, etc. I want the field to be a combination of letters and numbers, at least 8 digits long, completely random for security porposes, but do

Fwd: auto increment format

2007-08-07 Thread Olexandr Melnyk
developing a MySQL database and want to auto increment a field, but I don't want it to just count 1,2,3, etc. I want the field to be a combination of letters and numbers, at least 8 digits long, completely random for security porposes, but do this automatically, everytime a record is added

Re: Fwd: auto increment format

2007-08-07 Thread Lucas . CTR . Heuman
Int'l Airport, NJ 08405 Phone 609.485.5401 Olexandr Melnyk [EMAIL PROTECTED] 08/07/2007 08:19 AM To mysql@lists.mysql.com cc Subject Fwd: auto increment format You can do that using a before insert trigger, something like (untested) : CREATE TRIGGER test1bi BEFORE INSERT ON test1

Re: Fwd: auto increment format

2007-08-07 Thread David T. Ashley
Developer Ricomm Systems Inc. FAA, WJHTC/Bldg 300, 3nd Fl., L33 Atlantic City Int'l Airport, NJ 08405 Phone 609.485.5401 Olexandr Melnyk [EMAIL PROTECTED] 08/07/2007 08:19 AM To mysql@lists.mysql.com cc Subject Fwd: auto increment format You can do that using a before insert

auto increment format

2007-08-07 Thread Boyd Hemphill
Shivendra: It looks to me based on your example that you are creating a smart field where the first three chars are some sort of category and the numeric part is random. If you example is accurate then a char(3) field and a standard auto_increment field will do the trick. If uniqueness is

Re: auto increment format

2007-08-07 Thread David T. Ashley
On 8/7/07, Boyd Hemphill [EMAIL PROTECTED] wrote: Suggestions to use a hash are a problem because once you have a few million rows the likelihood of a collision is quite high if you cannot afford an error stopping your application. This means that if you write a trigger (the obvious way to

need auto increment value

2006-10-11 Thread balaraju mandala
Hello Everybody, i want to read the latest value of a autoincrement column from a java program. How can i do this? i want to do this in a single query insertion, is it possible?

Re: need auto increment value

2006-10-11 Thread Johan Höök
Hello, you can do it in two ways I guess: one is to do a second select (which you don't want): SELECT LAST_INSERT_ID(). another way is to use java.sql.Statement.RETURN_GENERATED_KEYS when you create your Statement, something along these lines: java.sql.PreparedStatement pstmt =

Combined Primary Key and Auto Increment Primary Key

2006-10-03 Thread Chris White
Hi all, I had somewhat of a performance question. I have an association table with 2 unique values which will always be selected by one of the values (never by id). That said, I'm wondering which would be a better gain, having this: CREATE TABLE association_sample ( `id` INTEGER NOT NULL

Re: Combined Primary Key and Auto Increment Primary Key

2006-10-03 Thread Dan Buettner
Chris, I'd opt for the first, but with an index on each of association_id1 and association_id2. I like always having an identity column to be able to remove or update an individual entry easily. But for speed, you'll want indexes on the other columns. I would either do no multi-column indexes,

RE: Combined Primary Key and Auto Increment Primary Key

2006-10-03 Thread Jerry Schwartz
Message- From: Chris White [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 03, 2006 2:20 PM To: mysql@lists.mysql.com Subject: Combined Primary Key and Auto Increment Primary Key Hi all, I had somewhat of a performance question. I have an association table with 2 unique values which

Auto increment Primary Index fields in replicated db

2006-03-13 Thread Jeff
All, We are using circular replication now on db's that were originally stand alone. One problem we have is that all the primary index fields for most of the tables are auto increment fields. This prevents us from writing to both db servers because of confilicting INDEX entries. Is there some

Re: Auto increment Primary Index fields in replicated db

2006-03-13 Thread Kishore Jalleda
down for variables auto_increment_*) Kishore Jalleda On 3/13/06, Jeff [EMAIL PROTECTED] wrote: All, We are using circular replication now on db's that were originally stand alone. One problem we have is that all the primary index fields for most of the tables are auto increment fields

Auto-increment indexes

2006-01-20 Thread Adrian Bruce
Hi, im hoping to solve a problem that is bugging me! I just moved a database from a development server to production (test), several of the fields have auto-increment ticked but as it is mainly a data warehouse i thought nothing of it. I then found that a lot of my queries were running slow

  1   2   3   4   5   >