zoukankan      html  css  js  c++  java
  • 每日博客

    时间:上午9:00-12:00

    代码:200多行?

    博客:1

    知识点:数据库

    级联删除触发器
    CREATE TRIGGER tr2
    ON Student
    AFTER DELETE
    As
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON ;
    -- Insert statements for trigger here
    delete from sc where sno = (select sno from deleted)
    END
    GO
    级联修改触发器
    ALTER TRIGGER[dbo] . [tr3]
    ON[dbo] . [Student]
    AFTER UPDATE
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for trigger here
    update SC set sno= ( select sno from inserted)
    where sno=(select sno from deleted )
    END
    受限插入触发器
    CREATE TRIGGER tr4
    ON student
    AFTER INSERT
    As
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for trigger here
    delete from sc where sno=( select sno from inserted where sno not in
    (select sno from student ) )
    or cno=(select cno from inserted where cno not in (select cno from course ) )
    END
    Go
  • 相关阅读:
    jquery学习
    java--MVC引入JUnit单元测试
    BAE引擎发布到外网
    ORACLE1.26 综合:游标和动态SQL
    ORACLE1.25 动态SQL
    ORACLE1.24 银行系统操作和游标
    ORACLE1.23 loop,whild.for循环
    ORACLE1.23 if case when
    ORACLE1.22 %type %rowtype
    ORACLE1.21 PLSQL 01
  • 原文地址:https://www.cnblogs.com/hfy717/p/14583951.html
Copyright © 2011-2022 走看看