今天看一本数据库的书,要求写一个保证表间完整性的触发器(学生、课程、选课三个表),他给的答案是这样的:
create trigger sc_update on sc
for update
as if(select count(*)
      from student,updated,course
      where student.sno=updated.sno and course.cno=updated.cno)=0
rollback transaction
请问updated是什么表?

解决方案 »

  1.   

    好象只有两种表哦,一种是inserted和deleted,
      

  2.   

    我只见过inserted,deleted这两种,
      

  3.   

    To:  lxzm1001(*蓝星之梦*) 兄
    这两天都看到你,你们星期不休息??
      

  4.   

    或许updated是他们自己建的一个表,也有可能
      

  5.   

    好象只有两种表,inserted和deleted,updated没见过
      

  6.   

    关注 SQL Server 啊 努力 奋斗-----------------------------------------------------
      

  7.   

    我试过了,sql server里面没有updated的逻辑表
      

  8.   

    --自己看看 For update 的
    create table T(a int,b int)
    insert into T select 1,1
    go--创建触发器
    create trigger trg_A
    on T
    for update
    as
    begin
        if update(a)
            update t1 set b=t1.b+1 from T t1 where exists(select 1 from inserted where b=t1.b)
        
        if update(b)
            update t1 set a=t1.a+1 from T t1 where exists(select 1 from inserted where a=t1.a)
    end
    go--执行触发操作
    update T set b=b+2
    select * from t
      

  9.   

    updated, 他们发明的?
      

  10.   

    update Sql2000?
     SQL Server 啊 努力 奋斗-----------------------------------------------------