Re: How to get auto Increment ID of INSERT?

2015-10-08 Thread Carsten Pedersen
RT_ID(). 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 occ

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 of the

Re: auto-increment more than one field

2013-05-14 Thread Jan Steinman
> From: rounak jain > > 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 of

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 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-table-wi

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

2011-06-16 Thread Hank
removed and mysql restarted so "db.log" is no longer ignored in >> >> replication, >> >> this bug goes away and correct results are reported on the slave. >> >> >> >> -Hank Eskin >> >> >> >> >> >> On Wed, J

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
s no longer ignored in > >> replication, > >> this bug goes away and correct results are reported on the slave. > >> > >> -Hank Eskin > >> > >> > >> On Wed, Jun 15, 2011 at 4:38 PM, Hank wrote: > >> > >> > > >

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

2011-06-15 Thread Hank
ger ignored in >> replication, >> this bug goes away and correct results are reported on the slave. >> >> -Hank Eskin >> >> >> On Wed, Jun 15, 2011 at 4:38 PM, Hank wrote: >> >> > >> > This is a follow-up to my previous post. I have been nar

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
t; > -Hank Eskin > > > On Wed, Jun 15, 2011 at 4:38 PM, Hank 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 pri

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

2011-06-15 Thread Hank
this bug goes away and correct results are reported on the slave. -Hank Eskin On Wed, Jun 15, 2011 at 4:38 PM, Hank 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

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 a possible replication bug in 5.5.8/5.5.11 (auto-increment in primary key)

2011-06-14 Thread Claudio Nanni
more > information as to what's 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

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

2011-06-14 Thread Hank
hing 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 into the "test" table (above, not ignored) repres

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 wh

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

2011-06-14 Thread Hank
gt; >> On Mon, Jun 13, 2011 at 10:33 PM, Claudio Nanni < > claudio.na...@gmail.com>wrote: > >> > >>> Hank, > >>> > >>> I can't reproduce it right now, > >>> But it really seems a bug. > >>> Just a shot in the d

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

2011-06-13 Thread Claudio Nanni
>> >> >> On Mon, Jun 13, 2011 at 10:33 PM, Claudio Nanni wrote: >> >>> Hank, >>> >>> I can't reproduce it right now, >>> But it really seems a bug. >>> Just a shot in the dark, Are you sure you have statement based

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

2011-06-13 Thread Hank
hot in the dark, Are you sure you have statement based and not >> mixed replication? >> I don't even know if that would affect , just an idea. >> >> Claudio >> On Jun 14, 2011 3:07 AM, "Hank" wrote: >> > Hello All, >> > >> >

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

2011-06-13 Thread Hank
n't even know if that would affect , just an idea. > > Claudio > On Jun 14, 2011 3:07 AM, "Hank" 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 bas

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

2011-06-13 Thread Claudio Nanni
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

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.

Re: [setting value when INSERT for auto increment]

2011-05-16 Thread Basil Daoust
m: "Grega Leskovšek" 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'

Re: [setting value when INSERT for auto increment]

2011-05-16 Thread Johan De Meersman
ject: [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, filesize($

[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 i

Re: Auto-Increment Values in Mysql

2011-02-09 Thread Jan Steinman
> From: Adarsh Sharma > > 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 NO

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

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

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 inse

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

Re: INSERT with auto increment

2010-06-30 Thread Jan Steinman
From: "David Stoltz" 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 all direct c

Re: INSERT with auto increment

2010-06-30 Thread Jo�o C�ndido de Souza Neto
rg... 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 VAL

Re: INSERT with auto increment

2010-06-30 Thread Michael Dykman
27;stuff') the auto-increment will engage on an insert of 0 - michael dykman On Wed, Jun 30, 2010 at 1:30 PM, David Stoltz 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 INS

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 V

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 > >wrote: >> >> >> >>> Wouldn

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 wrote: 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

Re: Auto Increment in InnoDB

2010-04-22 Thread mos
ile. 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 the records will look like --

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
On Thu, Apr 22, 2010 at 1:34 PM, Carsten Pedersen wrote: > 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 sharp today, ap

Re: Auto Increment in InnoDB

2010-04-22 Thread Carsten Pedersen
On Thu, 22 Apr 2010 13:12:16 +0200, Johan De Meersman 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 sequence numbe

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 wrote: > How can count(*) in an InnoDB table be faster than MAX() considering t

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 func

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 clu

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 http://dev.mys

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
On Thu, Apr 22, 2010 at 12:09 PM, Aveek Misra 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 changes? > You want

Re: Auto Increment in InnoDB

2010-04-22 Thread Aveek Misra
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 th

Re: Auto Increment in InnoDB

2010-04-22 Thread Johan De Meersman
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 > Increment column as a secondary column in a multiple column index. How can I > get the same behavior

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

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

2009-12-24 Thread Jaime Crespo Rincón
2009/12/23 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? If you refer to this bug: <http://bugs.mysql.com/bug.p

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

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 wrote: > Hi; > > mysql> insert into categories (Category, Parent) values ('test', NULL); > ERROR 1062 (23000): Duplicate entry '0' for key 1 > mysql> describe categories; > +--+-+--+-+-+

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?

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 Pardeike

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 r

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 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 | +-+--+--+-+---+---

Auto increment?

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

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
ssing 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-

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

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 >Su

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($

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 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 i

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

2009-02-26 Thread PJ
; [JS] Are you 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"

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

2009-02-25 Thread Jerry Schwartz
ry, >accessed by user/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

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 u

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

2009-02-25 Thread PJ
to use autoincrement, you can run into a race >> condition where two people are inserting at the same time, thus >> having the same generated id. >> >> Hope that helps. >> >> >> ____ >> >> From: PJ [mailto:af.gour

RE: non-auto increment question

2009-02-25 Thread Gary W. Smith
ing 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 in the field (id). I cannot use au

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 MA

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 it wit

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 tha

Re: reset auto increment to a lesser value

2008-08-02 Thread Mark Goodge
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 any

Re: reset auto increment to a lesser value

2008-08-02 Thread abhishek jain
ECTED]> wrote: > >> 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 >> > > Hi Nacho, Thanks for the reply, But as per a thread

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: 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

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.

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!

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: Reset a auto increment field?

2007-08-29 Thread Shawn Green
Jason Pruim wrote: 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 field i

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 it

RE: Reset a auto increment field?

2007-08-29 Thread Jerry Schwartz
.8341 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:

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 based

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 is

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

RE: Reset a auto increment field?

2007-08-29 Thread emierzwa
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 > databas

Re: Reset a auto increment field?

2007-08-29 Thread dpgirago
the total count? > > 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 th

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? Hop

Re: auto increment format

2007-08-08 Thread Brent Baisley
case it will increment. 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&#

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 wa

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 i

Re: Fwd: auto increment format

2007-08-07 Thread David T. Ashley
deserve, > > __ > Lucas Heuman > Web 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]&g

Re: Fwd: auto increment format

2007-08-07 Thread Lucas . CTR . Heuman
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" trigger, something like (untested) : CRE

Fwd: auto increment format

2007-08-07 Thread Olexandr Melnyk
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

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, b

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 = myconnec

need auto increment value

2006-10-10 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: Combined Primary Key and Auto Increment Primary Key

2006-10-03 Thread Jerry Schwartz
FAX: 860.674.8341 > -Original 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 perfor

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,

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 A

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

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

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   >