2016-07-07 35 views
0

我想連接用繩子新的用戶名和我有以下觸發:MySQL的觸發器 - 截斷不正確雙重錯誤

CREATE DEFINER=`root`@`localhost` TRIGGER `rating_platform`.`admins_BEFORE_INSERT` BEFORE INSERT ON `admins` FOR EACH ROW 
BEGIN 
SET NEW.username = NEW.username + "test"; 
END 

我收到此錯誤:

ERROR 1292: 1292: Truncated incorrect DOUBLE value: 'test'

我是什麼做錯了?

回答

1

使用CONCAT功能:

SET NEW.username = CONCAT(NEW.username,"test"); 
+0

謝謝,按預期工作! –