Hi!
I just tried this once again & its working fine for me...can you tell me which MySQL version you are using & also post your table structure..
from MyODBC Error Codes I noticed that this error(Error 23000) will be generated for Integrity constraint violation
This is the sample table I had created for testing..
# Generation Time: May 06, 2005 at 09:58 AM
# Server version: 4.0.18
# Database : `test`
#
# Table structure for table `mytable`
#
CREATE TABLE `mytable` (
`id` int(11) NOT NULL auto_increment,
`copy_id` int(11) NOT NULL default '0',
`fname` varchar(25) NOT NULL default '',
`lname` varchar(25) default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=3 ;
INSERT INTO mytable VALUES
('','','umesh','shastry');
SELECT @last := LAST_INSERT_ID();
UPDATE mytable SET copy_id=@last where id=@last;
Regards,
Umesh Shastry
http://www.blogger.com/profile/02551756983528645221