如何在MySql中编写触发器 [英] How to write a trigger in MySql

查看:226
本文介绍了如何在MySql中编写触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

当表的垂直列更新时,我需要编写一个Update触发器..

我尝试了以下查询.

之后,

Hi all.

i need write a Update trigger when the table''s perticular column updated..

i tried the following query.

create Trigger Trigger1 after Update of EMPID on  EMPmaster for  each row
begin
insert into EMPMaster_Backup (OLDEMPID) values (EMPID );
end;




但是它显示出错误.





But it showing error .


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 'of EMPID on  EMPmaster for  each row
begin
insert into EMPMaster_Backup ' at line 1

推荐答案

使用触发器本身作为触发器的名称.

http://dev.mysql.com/doc/refman/5.0/en/create- trigger.html [^ ]

祝你好运!
I think you cannot use Trigger itself as the name of your trigger.

http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html[^]

Good luck!


这篇关于如何在MySql中编写触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆