I'll have to investigate how to do a transaction from Access. I guess
pass-through queries might do it, but I'm not sure.
-Original Message-
From: Carsten Pedersen [mailto:cars...@bitbybit.dk]
Sent: Sunday, January 23, 2011 9:36 AM
To: Jerry Schwartz
Cc: 'mysql.'
Subject: Re: CURRENT
-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,
auto_increment that, and grab that value first
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 table
2011/1/21 Jerry Schwartz je...@gii.co.jp:
-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
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
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
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
-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_insert_id() in the argument list would
likely
-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...@gmail.com]
Sent: Friday, January 21, 2011 11:50 AM
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
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 je...@gii.co.jp 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
@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
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 dstepli...@gmail.com escreveu na
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
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
-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´t set the auto_incremente value field
-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
...
[JS] I wish it were that easy. new.id is null until after
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:
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
18 matches
Mail list logo