CREATE   TRIGGER   [三体系与组织基本_trigger_20111021] 
ON  dbo.组织基本信息三体系联合表
FOR   UPDATE  
AS  
update  dbo.dbo_tblORGInform组织基本信息S1001
set   
联系地址=i.联系地址,
ORGName组织名称中=i.ORGName组织名称中,
企业注册地址=i.企业注册地址,(case when ORGSystem 领域='Q' and 合同初审费 is not null then 合同初审费=i.合同初审费 else null end ) as 合同初审费,
(case when ORGSystem 领域='E' and E合同初审费 is not null then E合同初审费=i.E合同初审费 else null end )as E合同初审费,
 (case when ORGSystem 领域='S' and S合同初审费 is not null then S合同初审费=i.S合同初审费 else null end ) as S合同初审费,(case when ORGSystem 领域='Q' and 合同监审费 is not null then 合同初审费=i.合同监审费 else null end ) as 合同监审费,
 (case when ORGSystem 领域='E' and E合同监审费 is not null then E合同监审费=i.E合同监审费 else null end ) as E合同监审费,
 (case when ORGSystem 领域='S' and S合同监审费 is not null then S合同监审费=i.S合同监审费 else null end )as  S合同监审费,(case when ORGSystem 领域='Q' and 监审实收额 is not null then 监审实收额=i.监审实收额 else null end ) as 监审实收额,
 (case when ORGSystem 领域='E' and E监审实收额 is not null then E监审实收额=i.E监审实收额 else null end ) as E监审实收额,
 (case when ORGSystem 领域='S' and S监审实收额 is not null then S监审实收额=i.S监审实收额 else null end )as  S监审实收额from  组织基本信息三体系联合表 ,inserted  i
where    i.ORGID组织编号=dbo_tblORGInform组织基本信息S1001.ORGID组织编号

解决方案 »

  1.   

    所有类似
    (case when ORGSystem 领域='Q' and 合同初审费 is not null then 合同初审费=i.合同初审费 else null end ) as 合同初审费,改成合同初审费 = (case when ORGSystem 领域='Q' and 合同初审费 is not null then 合同初审费=i.合同初审费 else null end ),
      

  2.   

    CREATE TRIGGER [三体系与组织基本_trigger_20111021]  
    ON dbo.组织基本信息三体系联合表
    FOR UPDATE   
    AS   
    update dbo.dbo_tblORGInform组织基本信息S1001
    set   
    联系地址=i.联系地址,
    ORGName组织名称中=i.ORGName组织名称中,
    企业注册地址=i.企业注册地址,(case when ORGSystem 领域='Q' and 合同初审费 is not null then 合同初审费=i.合同初审费 else null end ),
    (case when ORGSystem 领域='E' and E合同初审费 is not null then E合同初审费=i.E合同初审费 else null end ),
     (case when ORGSystem 领域='S' and S合同初审费 is not null then S合同初审费=i.S合同初审费 else null end ),(case when ORGSystem 领域='Q' and 合同监审费 is not null then 合同初审费=i.合同监审费 else null end ),
     (case when ORGSystem 领域='E' and E合同监审费 is not null then E合同监审费=i.E合同监审费 else null end ),
     (case when ORGSystem 领域='S' and S合同监审费 is not null then S合同监审费=i.S合同监审费 else null end ),(case when ORGSystem 领域='Q' and 监审实收额 is not null then 监审实收额=i.监审实收额 else null end ) ,
     (case when ORGSystem 领域='E' and E监审实收额 is not null then E监审实收额=i.E监审实收额 else null end ) ,
     (case when ORGSystem 领域='S' and S监审实收额 is not null then S监审实收额=i.S监审实收额 else null end )from 组织基本信息三体系联合表 ,inserted i
    where i.ORGID组织编号=dbo_tblORGInform组织基本信息S1001.ORGID组织编号 
     
     
      

  3.   

    所有类似
    (case when ORGSystem领域='Q' and 合同初审费 is not null then 合同初审费=i.合同初审费 else null end ) as 合同初审费,改成合同初审费 = (case when ORGSystem领域='Q' and 合同初审费 is not null then i.合同初审费 else null end ),
      

  4.   

    所有类似
    (case when ORGSystem领域='Q' and 合同初审费 is not null then 合同初审费=i.合同初审费 else null end ) as 合同初审费,改成合同初审费 = (case when i.ORGSystem领域='Q' and i.合同初审费 is not null then i.合同初审费 else null end ),
      

  5.   

    错误了。
    与组织基本_trigger_20111021,第 12 行
    在应使用条件的上下文(在 '领域' 附近)中指定了非布尔类型的表达式。
      

  6.   

     then 合同初审费=i.合同初审费
      

  7.   

    (case when ORGSystem 领域='Q' and 合同初审费 is not null then i.合同初审费 else null end ) as 合同初审费,
    (case when ORGSystem 领域='E' and E合同初审费 is not null then  i.E合同初审费 else null end )as E合同初审费,
     (case when ORGSystem 领域='S' and S合同初审费 is not null then  i.S合同初审费 else null end ) as S合同初审费,
      

  8.   

    在SET语句后面不能用这样用的
    as 合同初审费应该是 set 合同初审费='xxx'这样才正确。
      

  9.   

    ORGSystem 领域你原来这么写的,字段名改对来就可以了
      

  10.   

    CREATE TRIGGER [三体系与组织基本_trigger_20111021]  
    ON dbo.组织基本信息三体系联合表
    FOR UPDATE   
    AS   
    update dbo.dbo_tblORGInform组织基本信息S1001
    set   
    联系地址=i.联系地址,
    ORGName组织名称中=i.ORGName组织名称中,
    企业注册地址=i.企业注册地址,合同初审费=(case when ORGSystem 领域='Q' and 合同初审费 is not null then i.合同初审费 else null end ) ,
    ...
    from 组织基本信息三体系联合表 ,inserted i
    where i.ORGID组织编号=dbo_tblORGInform组织基本信息S1001.ORGID组织编号
      

  11.   

    消息 207,级别 16,状态 1,过程 三体系与组织基本_trigger_20111021,第 11 行
    列名 'ORGSystem 领域' 无效。
    消息 209,级别 16,状态 1,过程 三体系与组织基本_trigger_20111021,第 11 行
    列名 '合同初审费' 不明确。
    消息 207,级别 16,状态 1,过程 三体系与组织基本_trigger_20111021,第 12 行
    列名 'ORGSystem 领域' 无效。
    消息 207,级别 16,状态 1,过程 三体系与组织基本_trigger_20111021,第 12 行
    列名 'E合同初审费' 无效。
    消息 207,级别 16,状态 1,过程 三体系与组织基本_trigger_20111021,第 13 行
    列名 'ORGSystem 领域' 无效。
    消息 207,级别 16,状态 1,过程 三体系与组织基本_trigger_20111021,第 13 行
    列名 'S合同初审费' 无效。
    消息 207,级别 16,状态 1,过程 三体系与组织基本_trigger_20111021,第 15 行