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组织编号
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组织编号
解决方案 »
- insert 本表的累计数
- 请教远程复制数据问题
- |zyciis| 有两个数据库都在同一台服务器,能不能用一条查询语句动态的把A数据库里的表生成到B数据库里面呢
- 求SQL语句
- 这个查询怎么写?
- Sql 2005镜像自动中断的问题
- ---------------------[[在线求救一条SQL语句]]---------------------------
- 请问一个SQL的函数
- 库存配套问题,请高手指点有高分。
- 数据库中有近2000个表,有一个非常重要的字段(如:物料编码)它可能存在许多表中,并有许多关联,如何把数据库中所有表中的这个字段都增
- 在创建存储过程时提示……,问不能创建的原因?
- 查询日期是,对日期格式的转换问题!!
(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 ),
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组织编号
(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 ),
(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 ),
与组织基本_trigger_20111021,第 12 行
在应使用条件的上下文(在 '领域' 附近)中指定了非布尔类型的表达式。
(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合同初审费,
as 合同初审费应该是 set 合同初审费='xxx'这样才正确。
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组织编号
列名 '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 行