[SQL]声明触发器 <待整理>

[SQL]声明触发器 <待整理>
5./*声明触发器
create trigger dl_stu_mess4 on student for delete
as
declare @name_id int
select @name_id=stu.name from student stu,deleted d where stu.name=d.name
if exists(select * from books where books.name=@name_id)
delete from books where books.name=@name_id
print ‘jhsdjkjk‘
print @name_id
*/
/*
create trigger dl_stu_mess3 on books for delete
as
declare @name_id int
select @name_id=bo.name from books bo,deleted d where bo.name=d.name
if exists(select * from student where student.name=@name_id)
delete from student where student.name=@name_id
print ‘jhsdjkjk‘
print @name_id
*/
--sp_depends books 查看触发器
--sp_helptrigger student; 查看触发器信息
--drop trigger dl_stu_mess4; 删除触发器
insert into student values(2,4jkjjk,d,j,shs);
--delete from student where stu.name=2; 删除操作
select * from student;
--delete from books where books.name=2
--select * from books;
[SQL]声明触发器 <待整理>

[SQL]声明触发器 <待整理>,布布扣,bubuko.com

[SQL]声明触发器 <待整理>

上一篇:[SQL]sql介绍


下一篇:编译安装mysql-5.5.33