2011/1/21 Jerry Schwartz :
>>-Original Message-
>>From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br]
>>Sent: Friday, January 21, 2011 12:47 PM
>>To: mysql@lists.mysql.com
>>Subject: Re: CURRENT insert ID
>>
>>Ok, you must have you
On 24/01/2011 15:42, Jerry Schwartz wrote:
-Original Message-
From: Donovan Brooke [mailto:li...@euca.us]
Sent: Friday, January 21, 2011 7:28 PM
Cc: mysql@lists.mysql.com
Subject: Re: CURRENT insert ID
Just an idear..
Don't auto_increment the main table.. create a unique Id
>-Original Message-
>From: Donovan Brooke [mailto:li...@euca.us]
>Sent: Friday, January 21, 2011 7:28 PM
>Cc: mysql@lists.mysql.com
>Subject: Re: CURRENT insert ID
>
>Just an idear..
>
>Don't auto_increment the main table.. create a unique Id table,
>
Cc: 'mysql.'
>Subject: Re: CURRENT insert ID
>
>Seeing from later posts that you're using InnoDB, why don't you simply
>wrap the INSERT/UPDATE into a transaction? You don't avoid the UPDATE,
>but I'm not sure I understand the need to mess w/ triggers.
>
ehr...
Den 23-01-2011 15:36, Carsten Pedersen skrev:
Seeing from later posts that you're using InnoDB, why don't you simply
wrap the INSERT/UPDATE into a transaction? You don't avoid the UPDATE,
but I'm not sure I understand the need to mess w/ triggers.
BEGIN
INSERT INTO t(id) NULL
UPDATE t SE
Seeing from later posts that you're using InnoDB, why don't you simply
wrap the INSERT/UPDATE into a transaction? You don't avoid the UPDATE,
but I'm not sure I understand the need to mess w/ triggers.
BEGIN
INSERT INTO t(id) NULL
UPDATE t SET xxx=last_insert_id()
COMMIT
Best,
/ Carsten
Den
Hi,
On 22/01/2011, at 11:27 AM, Donovan Brooke wrote:
> Just an idear..
>
> Don't auto_increment the main table.. create a unique Id table,
> auto_increment that, and grab that value first for use with both fields in
> your main table.
This can be wrapped into a trigger, so the main table fun
Just an idear..
Don't auto_increment the main table.. create a unique Id table,
auto_increment that, and grab that value first for use with both fields
in your main table.
Donovan
--
D Brooke
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:h
>-Original Message-
>From: Michael Dykman [mailto:mdyk...@gmail.com]
>Sent: Friday, January 21, 2011 1:27 PM
>To: Jerry Schwartz
>Cc: MySql
>Subject: Re: CURRENT insert ID
>
>You don't need to do an update:
>
>...
>
>new.xxx = new.id
>...
>
>-Original Message-
>From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br]
>Sent: Friday, January 21, 2011 12:47 PM
>To: mysql@lists.mysql.com
>Subject: Re: CURRENT insert ID
>
>Ok, you must have your own reasons to do that.
>
>The fact is: You can
; 'MySql'
>>Subject: RE: CURRENT insert ID
>>
>>>-Original Message-
>>>From: Michael Dykman [mailto:mdyk...@gmail.com]
>>>Sent: Friday, January 21, 2011 11:50 AM
>>>To: MySql
>>>Subject: Re: CURRENT insert ID
>>>
&g
Ok, you must have your own reasons to do that.
The fact is: You can´t set the auto_incremente value field to another field
in the same table and record even in a trigger.
So, the best way is a second update.
--
João Cândido de Souza Neto
"Darryle Steplight" escreveu na mensagem
news:AANL
@Joao - I'm currently building a database out right now that has this
scenario. One field can be the primary key, that has a purpose for holding
the record id, another field can hold the value. Let say there are two
fields, id, s_id. Initially, you insert a record and `id` is now 100 and you
update
I can´t think about how useful for you would be to have two fields with the
same value.
--
João Cândido de Souza Neto
""Jerry Schwartz"" escreveu na mensagem
news:007501cbb98a$177acba0$467062e0$@co.jp...
Here it is in a nutshell:
I have a field that needs to be set equal to the auto-inc
I made a typo in my previous message.
>-Original Message-
>From: Jerry Schwartz [mailto:je...@gii.co.jp]
>Sent: Friday, January 21, 2011 12:20 PM
>To: 'Jerry Schwartz'; 'Michael Dykman'; 'MySql'
>Subject: RE: CURRENT insert ID
>
>
>-Original Message-
>From: Jerry Schwartz [mailto:je...@gii.co.jp]
>Sent: Friday, January 21, 2011 11:56 AM
>To: 'Michael Dykman'; 'MySql'
>Subject: RE: CURRENT insert ID
>
>>-Original Message-
>>From: Michael Dykman [mailto:mdyk...
>-Original Message-
>From: Michael Dykman [mailto:mdyk...@gmail.com]
>Sent: Friday, January 21, 2011 11:50 AM
>To: MySql
>Subject: Re: CURRENT insert ID
>
>I think an ON INSERT TRIGGER would take care of this; can't think of
>any other way. Using last_ins
I think an ON INSERT TRIGGER would take care of this; can't think of
any other way. Â Using last_insert_id() in the argument list would
likely yield you the previous value (which might not even related to
your table.
Having siad that.. Â odd requirement.
 - michael dykman
ps -- sorry for the
18 matches
Mail list logo