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
  • 相关阅读:
    python
    springboot-mybatis-pagehelper(分页插件)
    图片验证码工具类
    http工具类
    page工具类
    生成count位随机数工具类
    日期工具类
    dozer工具类
    list自定义排序工具类
    fastJson工具类
  • 原文地址:https://www.cnblogs.com/hfy717/p/14583951.html
Copyright © 2011-2022 走看看