没有任何错误信息,只是表table_sckc里没能被触发!表table_spmx里都有数据,但表table_cskc里却没有数据!

解决方案 »

  1.   

    create trigger trigger_ckgl_sckc on table_ckgl
    for insert
    as
    begin
    update table_sckc
    set xykc=xykc+yhsl from table_sckc a inner join inserted b on a.xsdw=b.yhdw and a.sph=b.sphupdate table_spmx
    set kcl=kcl-yhsl from table_spmx a inner join inserted b on spbh=sph
    end   --上面应该是一个完整的触发器吧
    goinsert table_ckgl(sph,yhsl)
    select sph,yhsl from inserted where sph not in(select sph from table_ckgl)insert table_ckgl(sph,yhsl)
    select sph,yhsl from inserted where sph not in(select sph from table_ckgl)
      

  2.   

    还有一个null值问题
    xykc=isnull(xykc,0)+isnull(yhsl,0)上面的改成这样试试