日期:2014-05-16  浏览次数:20885 次

mysql触发器出现错误
create trigger memuser
after insert on sj_members
for each row
begin
insert into hy_members set 

username=new.username,password=new.password;
end;

这个在MYSQL数据库中执行老是出现错误,版本是5.1的。出现以下错误:
MySQL 返回: 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7 


------解决方案--------------------
delimiter $$
create trigger memuser
after insert on sj_members
for each row
begin
insert into hy_members values(new.username,new.password);
end;$$
delimiter ;
------解决方案--------------------
先用 

delimiter $$
CREATE trigger memuser AFTER INSERT ON sj_members
FOR each
ROW
BEGIN
INSERT INTO hy_members( username,
PASSWORD )
VALUES (

new.username, new.password
);

END $$

delimiter;

------解决方案--------------------
delimiter;

这个命令的作用,你百度一下。