Re: AUTOINCREMENT / UNIQUE Behavior [Newbie Question]

2006-02-06 Thread Dan Nelson
In the last episode (Feb 06), David T. Ashley said: > I remember in MySQL that you can define an integer table field as > AUTOINCREMENT and UNIQUE (I might have the specific keywords wrong, > but everyone will know what I mean). > > In the life of a database where there are frequent additions and

Re: autoincrement for year

2005-12-28 Thread SGreen
Yes it could be but YOU DON'T NEED TRIGGERS. All you need is the auto_increment extension for multiple-column primary keys, as described by another post and demonstrated here: http://dev.mysql.com/doc/refman/4.1/en/example-auto-increment.html Shawn Green Database Administrator Unimin Corporatio

Re: autoincrement for year

2005-12-28 Thread Gleb Paharenko
Hello. This should be possible with triggers. See: http://dev.mysql.com/doc/refman/5.0/en/triggers.html "Salvatore Celsomino" <[EMAIL PROTECTED]> wrote: >Hi, >it is possible to create a field autoincrement for year. >example: >1/2005 >2/2005 >... >10500/2005 >new

Re: autoincrement for year

2005-12-28 Thread Pooly
2005/12/28, Salvatore Celsomino <[EMAIL PROTECTED]>: > Hi, > it is possible to create a field autoincrement for year. > example: > 1/2005 > 2/2005 > ... > 10500/2005 > new year-- > 1/2006 > 2/2006 > > This could be of interest : http://dev.mysql.com/doc/refman/5.0/en/

RE: autoincrement question

2004-08-25 Thread Victor Pendleton
You will have to call the last_insert_id() function in order to obtain the autoincrement value. -Original Message- From: dan orlic To: [EMAIL PROTECTED] Sent: 8/25/04 2:26 PM Subject: autoincrement question question: I have an insert statement that has a null for the value of the pr

RE: autoincrement problem

2004-06-12 Thread Osvaldo Sommer
For your problem, you need to create a table with a pool of availables key, and when you use one, you delete from this table and when you don't need it, return it here. Osvaldo Sommmer -Original Message- From: Nitin [mailto:[EMAIL PROTECTED] Sent: Saturday, June 12, 2004 3:44 AM To: MySQ

Re: autoincrement problem

2004-06-12 Thread Nitin
MySQL Mailing List" <[EMAIL PROTECTED]> Sent: Saturday, June 12, 2004 3:53 PM Subject: Re: autoincrement problem > Nitin wrote: > > >Hi all, > > > >What will be the best way to implement auto increment field. I dont want to use auto increment feature, as it on

Re: autoincrement problem

2004-06-12 Thread Daniel Kasak
Nitin wrote: Hi all, What will be the best way to implement auto increment field. I dont want to use auto increment feature, as it only appends the numbers but doesn't check for the values deleted. Suppose, following are the values in table 1abc 2bcd 3cde .. .. .. 9xyz

RE: autoincrement column

2004-04-08 Thread Andrew Presley
#x27;Arthur Radulescu'" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> Subject: RE: autoincrement column Date: Thu, 8 Apr 2004 12:50:58 -0700 Try truncate table. It essentially drops the table and recreates it. -- DVP > -Original Message- > From: Arthur Radulescu [mail

RE: autoincrement column

2004-04-08 Thread Dathan Vance Pattishall
Try truncate table. It essentially drops the table and recreates it. -- DVP > -Original Message- > From: Arthur Radulescu [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 08, 2004 10:36 AM > To: [EMAIL PROTECTED] > Subject: autoincrement column > > Before switching to version 4.0.18 of

Re: Autoincrement/last_insert_id race safe?

2003-03-26 Thread Ray
On Wednesday 26 March 2003 08:25, you wrote: > > A programmer just asked me about a possible race condition, > > and I didn't know what to answer: > > > > If I insert a line using autoincrement, then ask for last_insert_id() > > am I guaranteed to get the same ID I just inserted? > > Yes > > > It s

Re: Autoincrement/last_insert_id race safe?

2003-03-26 Thread Alec . Cawley
> A programmer just asked me about a possible race condition, > and I didn't know what to answer: > If I insert a line using autoincrement, then ask for last_insert_id() > am I guaranteed to get the same ID I just inserted? Yes > It seems that another program could be inserting at almost the

Re: Autoincrement/last_insert_id race safe?

2003-03-26 Thread Fred van Engen
Hi, On Wed, Mar 26, 2003 at 03:17:42PM +0100, Steve Rapaport wrote: > A programmer just asked me about a possible race condition, > and I didn't know what to answer: > > If I insert a line using autoincrement, then ask for last_insert_id() > am I guaranteed to get the same ID I just inserted? >

Re: Autoincrement field rollover

2003-03-07 Thread Alec . Cawley
> The primary key (message_id)is a UNSIGNED BIGINT, > Which is supposed to be 64 bit, with autoincrement. > The each row is deleted as soon as it is fetched > By the client, and also after the expiry of a period > (~30 days). > 64 bits does provide a large number, but there is a > possibility th

Re: Autoincrement field rollover

2003-03-06 Thread Paul DuBois
At 1:19 +0530 3/7/03, Jeethu Rao wrote: Hi, I'm using a mysql table to store small messages in a p2p messaging server. The primary key (message_id)is a UNSIGNED BIGINT, Which is supposed to be 64 bit, with autoincrement. The each row is deleted as soon as it is fetched By the client, and also after

Re: Autoincrement : how does it work / how to reset it

2003-02-01 Thread Nasser Ossareh
Auto_Increment will increment the last_INSERT_ID (which in your case is 10)... so the num field of the new entry will be 11. --- Robert Mena <[EMAIL PROTECTED]> wrote: > Hi, I have been using autoincrement fields for some > time but was wondering how does it work in some > "special" situations. >

Re: Autoincrement : how does it work / how to reset it

2003-02-01 Thread Benjamin Pflugmann
Hi. On Fri 2003-01-31 at 06:48:45 -0800, [EMAIL PROTECTED] wrote: > Hi, I have been using autoincrement fields for some > time but was wondering how does it work in some > "special" situations. Most of this depends on which MySQL version you use and which table type, unfortunately. OTOH, for the

Re: Autoincrement : how does it work / how to reset it

2003-02-01 Thread Zak Greant
On Fri, Jan 31, 2003 at 06:48:45AM -0800, Robert Mena wrote: > Hi, I have been using autoincrement fields for some > time but was wondering how does it work in some > "special" situations. > > Ex. suppose I have an autoincrement field called num > and the last one has value of 10. > > I delete th

Re: Autoincrement : how does it work / how to reset it

2003-02-01 Thread Adolfo Bello
On Fri, 2003-01-31 at 10:48, Robert Mena wrote: > Hi, I have been using autoincrement fields for some > time but was wondering how does it work in some > "special" situations. > > Ex. suppose I have an autoincrement field called num > and the last one has value of 10. > > I delete the last on and

Re: Autoincrement question

2002-08-12 Thread Egor Egorov
Alec, Friday, August 09, 2002, 2:01:10 PM, you wrote: AC> If I insert a number, say X, of records using a single statement of the AC> form AC> INSERT INTO table VALUES (...), (...), ..., (...) AC> then retrieve the LAST_INSERT_ID, say Y, is it reasonable to assume that AC> the records will

RE: Autoincrement in MultiColumn primary key?

2002-07-13 Thread Wouter van Vliet
Hmm, this all sounds indeed like a terrific feature .. if it would work ! So, I decided to try it and just see what'll happen. I did the following things: * first I created a table: mysql> create table autoIncrement ( -> id int(11) NOT NULL AUTO_INCREMENT, -> thingie varchar(20) NOT NU

Re: Autoincrement

2001-10-27 Thread Tony
If you have not obtained Paul DuBois's "MySQL" (New Riders pub, ISBN 0-7357-0921-1), you should consider it a great investment. For what it's worth, page 169 has a section on resequencing auto_increment columns that you might be able to apply to your database. Undoubtedly, there are pages o

Re: Autoincrement

2001-10-27 Thread Carl Troein
Joe writes: > Is there a query I can run to change the next autoindex to the next highest > integer in the column. > > I mean I have my userIDs, and they are autoincrementing. But if I have say > 9 users delete 5 of users, and then want to compact the table so that the > ids are all sequenti

Re: Autoincrement question

2001-10-26 Thread Bill Adams
Bill Adams wrote: > Demirchyan Oganes-AOD098 wrote: > > > Hello everyone, > > > > I wanted to ask you 2 questions. > > > > 1. I have a table that has 2 columns, user_id, > user_name. > > User_id has been setup to a default value 1000 > and to AUTO_INCREMENT. > > > > When I insert a record, Inser

Re: Autoincrement question

2001-10-26 Thread Bill Adams
Demirchyan Oganes-AOD098 wrote: > Hello everyone, > > I wanted to ask you 2 questions. > > 1. I have a table that has 2 columns, user_id, user_name. > User_id has been setup to a default value 1000 and to AUTO_INCREMENT. > > When I insert a record, Insert Into User_Table (user_id,user_name) Value

Re: autoincrement

2001-08-28 Thread Grigory Bakunov
Date |Tue, 28 Aug 2001 12:49:52 +0100 >From |[EMAIL PROTECTED] Hello! S> When you have just inserted a record into a table that autoincrements the S> primary key, S> is there a way of retrieving the id assigned at the same time? I'm using ASP S> to write the S> code in question , and I'm trying

Re: autoincrement

2001-08-28 Thread Ian Barwick
On Tuesday 28 August 2001 13:55, Harald Fuchs wrote: > In article <01082813314101.11299@redgrave>, > > Ian Barwick <[EMAIL PROTECTED]> writes: > > You mean using SELECT LAST_INSERT_ID() ? > > > >> and praying no other query was run at the same > >> time. > > > > Try locking the table for writes ju

Re: autoincrement

2001-08-28 Thread Ian Barwick
On Tuesday 28 August 2001 12:36, [EMAIL PROTECTED] wrote: > When you have just inserted a record into a table that autoincrements the > primary key, > is there a way of retrieving the id assigned at the same time? I'm using > ASP to write the > code in question , and I'm trying to find a better so

Re: Autoincrement Column reverting to zero...

2001-06-06 Thread Jeremy Zawodny
On Wed, Jun 06, 2001 at 07:02:52PM -0700, Tyrone Mills wrote: > SQL, QUERY > > I posted a little while back with a problem on several tables where > the autoincrement column reverted to zero for no apparent > reason. Now I know the reason, I just don't understand it, or know > what to do differen