这是我的第一张表:以下称A
create table clientLog
(id int primary key auto_increment,cimusername varchar(20),
username varchar(50),
password varchar(50),defrayPassWord varchar(50),
tel varchar(30),createtime timestamp default CURRENT_TIMESTAMP,
updatecreatetime varchar(30),buyongyuanyin varchar(300));
这是我的第一张表:以下称B
create table clientLogTig(id int primary key auto_increment,tig_clientLog_id int, tig_cimusername varchar(50),
tig_username varchar(50),tig_password varchar(50),tig_defrayPassWord varchar(50),
tig_buyongyuanyin varchar(50),tig_tel varchar(50) ,tig_createtime timestamp default CURRENT_TIMESTAMP);
数据库mysql.我想在表A做修改操作的时候把原来的数据保存在B表中.我创建触发器如下:
create trigger tigBisu
after
update on clientLog for each row
begin
insert into clientLogTig values(null,old.id,old.cimusername,old.username,old.password,old.defrayPassWord,old,buyongyuanyin,old.tel)
end;
但会出错,望高手们指教下.注:数据库里没有任何触发器.
出错如下:
you have an error in your SQL syntax;check the manual that corresphonds to your mysql server varsion for the right syntax to use near 'insert into clientLogTig values(null,old.id,old.cimusername,old.username,old.pas'line 5在线等.
create table clientLog
(id int primary key auto_increment,cimusername varchar(20),
username varchar(50),
password varchar(50),defrayPassWord varchar(50),
tel varchar(30),createtime timestamp default CURRENT_TIMESTAMP,
updatecreatetime varchar(30),buyongyuanyin varchar(300));
这是我的第一张表:以下称B
create table clientLogTig(id int primary key auto_increment,tig_clientLog_id int, tig_cimusername varchar(50),
tig_username varchar(50),tig_password varchar(50),tig_defrayPassWord varchar(50),
tig_buyongyuanyin varchar(50),tig_tel varchar(50) ,tig_createtime timestamp default CURRENT_TIMESTAMP);
数据库mysql.我想在表A做修改操作的时候把原来的数据保存在B表中.我创建触发器如下:
create trigger tigBisu
after
update on clientLog for each row
begin
insert into clientLogTig values(null,old.id,old.cimusername,old.username,old.password,old.defrayPassWord,old,buyongyuanyin,old.tel)
end;
但会出错,望高手们指教下.注:数据库里没有任何触发器.
出错如下:
you have an error in your SQL syntax;check the manual that corresphonds to your mysql server varsion for the right syntax to use near 'insert into clientLogTig values(null,old.id,old.cimusername,old.username,old.pas'line 5在线等.
解决方案 »
- 建立索引的问题,如何跟where子句融为一体?
- java调用存储过程,抛异常,返回FUNCTION does not exist,哭笑不得
- mysql最近执行命令时总是出现问题?
- 有什么方法 可以让root能够使用??
- 300分,高手都来!!,最新1126版 ,MySQL 实现中英文混合排序,离成功只差一步!新手也都来学习一下!!!!!!!
- 如何在存储过程中将列名作为变量
- Linux9上phpMyAdmin连mysql:#2003 - Can't connect to MySQL server on '192.168.0.1' (111)
- 有什么软件可以分析统计mysql的日志文件?
- mysql的小问题
- mysql启动时basedir/datadir与配置不一致
- 同步时出的怪问题
- set names 'xxx'
after
update on clientLog for each row
insert into clientLogTig select null,old.id,old.cimusername,old.username,old.password,old.defrayPassWord,old,buyongyuanyin,old.tel;
values (old......,old....);
写好具体的字段吧! 按照我写的修改下。
for each row
insert into clientLogTig values(null,old.id,old.cimusername,old.username,old.password,old.defrayPassWord,old,buyongyuanyin,old.tel)
for each row
begin
insert into clientLogTig values(null,old.id,old.cimusername,old.username,old.password,old.defrayPassWord,old,buyongyuanyin,old.tel);
end
//