Re: Data truncated for column 'TABLE_COMMENT'
Posted by: Devart Team
Date: May 28, 2010 01:35AM

Another way is to use LAST_INSERT_ID function -
http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_last-insert-id

Firstly, set default value for the link_id field -
ALTER TABLE sample
  CHANGE COLUMN link_id link_id INT(11) DEFAULT NULL;

or

ALTER TABLE sample
  CHANGE COLUMN link_id link_id INT(11) NOT NULL DEFAULT 0;

And run these statements -

INSERT INTO sample (name) VALUES ('x');
UPDATE sample SET link_id = LAST_INSERT_ID() where id = LAST_INSERT_ID();

Devart Company,
MySQL management tools
http://www.devart.com/dbforge/mysql/

Options: ReplyQuote


Subject
Views
Written By
Posted
11398
- -
May 27, 2010 05:30AM
Re: Data truncated for column 'TABLE_COMMENT'
6695
May 28, 2010 01:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.