mysql中如何添加触发器
发布网友
发布时间:2022-04-22 07:37
我来回答
共1个回答
热心网友
时间:2022-05-02 05:05
触发器语法:
create trriger <名称>
on { tablename | viewname } [ with Encyption ]
{ for | After | instead of } [ delete | insert | update ]
as <sql语句>
create trriger DML1 @id int
on 表1 for insert
as
select @id=id from 表1
if (id<>0)
begin
insert into 表2(id) values(@id)
end
go