sql 2008 写的触发器 在 sql 2000中运行总是报错?客户现场求解答啊

xch2125535 2011-12-04 03:09:41
alter TRIGGER NFD_2
ON t_BOS200000000
for update
AS
begin
SET NOCOUNT ON

declare @fcheckstatus int
select @fcheckstatus=fmulticheckstatus from inserted
if (@fcheckstatus=16)

begin
update PORequestEntry set fauxqty=t4.fqtynow from PORequestEntry as t1 --采购申请
inner join PORequest as t2 on t1.finterid=t2.finterid
inner join inserted as t3 on t2.fbillno=t3.fbillno_src
inner join t_BOS200000000Entry2 as t4 on t3.fid=t4.fid
where t1.fitemid=t4.fitemid
end

begin
update ICSMInquiryMtrlEntry set fneedauxqty=t2.fauxqty from ICSMInquiryMtrlEntry as t1 --询价单关联采购申请
inner join PORequestEntry as t2 on t1.fid_src=t2.finterid
where t1.fitemid=t2.fitemid
end

begin
update ICSMQuotationEntry set fneedauxqty =t2.fauxqty from ICSMQuotationEntry as t1 --报价单关联采购申请
inner join PORequestEntry as t2 on t1.fprinterid=t2.finterid
where t1.fitemid=t2.fitemid
end

begin
update t_rpContractEntry set fquantity =t2.fneedauxqty from t_rpContractEntry as t1 -- 合同关联询价单
inner join ICSMInquiryMtrlEntry as t2 on t1.fid_src=t2.fid
where t1.fproductid=t2.fitemid
end

begin
update POOrderEntry set fauxqty=t2.fauxqty from POOrderEntry as t1 --关联采购订单
inner join PORequestEntry as t2 on t1.fsourceinterid=t2.finterid
where t1.fitemid=t2.fitemid
end


if (@fcheckstatus=4)

begin
update PORequestEntry set fauxqty=t4.FDecimal from PORequestEntry as t1
inner join PORequest as t2 on t1.finterid=t2.finterid
inner join inserted as t3 on t2.fbillno=t3.fbillno_src
inner join t_BOS200000000Entry2 as t4 on t3.fid=t4.fid
where t1.fitemid=t4.fitemid
end

begin
update ICSMInquiryMtrlEntry set fneedauxqty=t2.fauxqty from ICSMInquiryMtrlEntry as t1 --询价单关联采购申请
inner join PORequestEntry as t2 on t1.fid_src=t2.finterid
where t1.fitemid=t2.fitemid
end

begin
update ICSMQuotationEntry set fneedauxqty =t2.fauxqty from ICSMQuotationEntry as t1 --报价单关联采购申请
inner join PORequestEntry as t2 on t1.fprinterid=t2.finterid
where t1.fitemid=t2.fitemid
end

begin
update t_rpContractEntry set fquantity =t2.fneedauxqty from t_rpContractEntry as t1 -- 合同关联询价单
inner join ICSMInquiryMtrlEntry as t2 on t1.fid_src=t2.fid
where t1.fproductid=t2.fitemid
end

begin
update POOrderEntry set fauxqty=t2.fauxqty from POOrderEntry as t1 --关联采购订单
inner join PORequestEntry as t2 on t1.fsourceinterid=t2.finterid
where t1.fitemid=t2.fitemid
end

end
...全文
195 11 打赏 收藏 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
唐诗三百首 2011-12-04
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 xch2125535 的回复:]
提示 SET NOCOUNT ON

附近有语法错误
[/Quote]
把"SET NOCOUNT ON"去掉试试,对程序逻辑不影响的.
xch2125535 2011-12-04
  • 打赏
  • 举报
回复
谢谢 各位 问题出在了 --采购申请

“--”
这个的注释上面。。我疯了
xch2125535 2011-12-04
  • 打赏
  • 举报
回复
提示 SET NOCOUNT ON

附近有语法错误
xch2125535 2011-12-04
  • 打赏
  • 举报
回复
to qianjin036a
这个开始方法试过了 也不行

-晴天 2011-12-04
  • 打赏
  • 举报
回复
不知道你的业务流程,试试这样:
alter TRIGGER NFD_2  
ON t_BOS200000000
for update
AS
begin
SET NOCOUNT ON

declare @fcheckstatus int
select @fcheckstatus=fmulticheckstatus from inserted
if (@fcheckstatus=16)

begin
update t1 set fauxqty=t4.fqtynow from PORequestEntry as t1 --采购申请
inner join PORequest as t2 on t1.finterid=t2.finterid
inner join inserted as t3 on t2.fbillno=t3.fbillno_src
inner join t_BOS200000000Entry2 as t4 on t3.fid=t4.fid
where t1.fitemid=t4.fitemid

update t1 set fneedauxqty=t2.fauxqty from ICSMInquiryMtrlEntry as t1 --询价单关联采购申请
inner join PORequestEntry as t2 on t1.fid_src=t2.finterid
where t1.fitemid=t2.fitemid

update t1 set fneedauxqty =t2.fauxqty from ICSMQuotationEntry as t1 --报价单关联采购申请
inner join PORequestEntry as t2 on t1.fprinterid=t2.finterid
where t1.fitemid=t2.fitemid

update t1 set fquantity =t2.fneedauxqty from t_rpContractEntry as t1 -- 合同关联询价单
inner join ICSMInquiryMtrlEntry as t2 on t1.fid_src=t2.fid
where t1.fproductid=t2.fitemid

update t1 set fauxqty=t2.fauxqty from POOrderEntry as t1 --关联采购订单
inner join PORequestEntry as t2 on t1.fsourceinterid=t2.finterid
where t1.fitemid=t2.fitemid
end


if (@fcheckstatus=4)

begin
update t1 set fauxqty=t4.FDecimal from PORequestEntry as t1
inner join PORequest as t2 on t1.finterid=t2.finterid
inner join inserted as t3 on t2.fbillno=t3.fbillno_src
inner join t_BOS200000000Entry2 as t4 on t3.fid=t4.fid
where t1.fitemid=t4.fitemid

update t1 set fneedauxqty=t2.fauxqty from ICSMInquiryMtrlEntry as t1 --询价单关联采购申请
inner join PORequestEntry as t2 on t1.fid_src=t2.finterid
where t1.fitemid=t2.fitemid

update t1 set fneedauxqty =t2.fauxqty from ICSMQuotationEntry as t1 --报价单关联采购申请
inner join PORequestEntry as t2 on t1.fprinterid=t2.finterid
where t1.fitemid=t2.fitemid

update t1 set fquantity =t2.fneedauxqty from t_rpContractEntry as t1 -- 合同关联询价单
inner join ICSMInquiryMtrlEntry as t2 on t1.fid_src=t2.fid
where t1.fproductid=t2.fitemid

update t12 set fauxqty=t2.fauxqty from POOrderEntry as t1 --关联采购订单
inner join PORequestEntry as t2 on t1.fsourceinterid=t2.finterid
where t1.fitemid=t2.fitemid
end

end
geniuswjt 2011-12-04
  • 打赏
  • 举报
回复
没看出错,不过写这触发器的人不适合做软件行业
-晴天 2011-12-04
  • 打赏
  • 举报
回复
程序写得好奇怪,写那么多begin end 干嘛?还有那个if,如果不用else 下面的更新语句都是重复的.
pengxuan 2011-12-04
  • 打赏
  • 举报
回复
什么错误呢
--小F-- 2011-12-04
  • 打赏
  • 举报
回复
报什么错误 ?语法没什么问题啊。
唐诗三百首 2011-12-04
  • 打赏
  • 举报
回复
要看一下详细的错误信息..
中国风 2011-12-04
  • 打赏
  • 举报
回复
出什么错误,语法没问题,这是兼容的

估计出在更新的数据上
内容概要:本文围绕“数据驱动下光伏建筑群源荷不确定性解析及其储能多目标低碳经济调度研究”展开,提出了一种融合数据驱动方法与多目标优化算法的综合调度框架。研究首先基于历史数据对光伏发电出力与建筑负荷的不确定性进行建模,采用概率预测与场景生成技术刻画源荷波动特性,并通过典型场景提取降低输入复杂性。在此基础上,构建了以最小化系统运行成本、降低碳排放强度、提升可再生能源消纳率为目标的多目标优化模型,引入NSGA-II等先进智能优化算法求解Pareto最优前沿,实现经济性与低碳性的协同优化。通过Python编程完成模型搭建与仿真验证,结果表明该方法能有效应对源荷双重不确定性,在保障供电可靠性的前提下,实现了储能系统的优化配置与多目标调度决策的均衡协调; 适合人群:具备一定电力系统基础知识和Python编程能力,从事能源系统优化、智能调度、低碳技术等相关领域的研究生、科研人员及工程技术人员; 使用场景及目标:①应用于光伏建筑群、工业园区微电网等分布式能源系统的运行调度;②支撑含储能系统的多目标低碳经济调度决策,兼顾能源成本节约与碳排放控制双重目标;③为相关课题的研究与工程实践提供完整的算法实现参考与可复现的仿真案例支持; 阅读建议:建议读者结合文中提供的Python代码深入理解模型构建与求解流程,重点关注不确定性建模与多目标优化的耦合机制,可在实际数据基础上复现并改进算法,进一步探索不同权重策略下的调度方案优选方法。
代码下载链接: https://pan.quark.cn/s/cd4149768c91 互联网灰度部署系统解决方案的核心内容深度阐释: 一、灰度发布概念 灰度发布(亦称金丝雀发布)是在云计算及互联网服务领域中常见的一种发布策略,其中心理念是在全面推广新版本前,先向部分用户群体开放试用,以此来降低更新过程中的潜在风险。这种发布模式能够有效地兼顾用户体验与系统稳定性,它允许企业逐步将新的代码或功能部署至生产环境,并且仅对部分用户群体可见。此种做法有助于提前识别潜在问题,对用户体验造成的影响较小,并且能够获取更为真实的用户反馈信息。 二、系统现状和建设背景 在传统的发布模式中,每次更新都需要暂停服务才能发布新版本,这在用户体验和服务连续性方面存在明显不足。伴随互联网经济的繁荣发展,移动终端与日常生活的融合日益紧密,对互联网系统的支撑需求持续增长。特别是在电信行业,系统需要实现7*24小时不间断服务,以适应快速变化的市场需求和频繁更新的技术。因此,迫切需要一种新的发布方式,即灰度发布,用以提升产品发布的效率并改善用户体验。 三、灰度发布的优势与挑战 灰度发布相较于传统全量发布的优势包括: 1. 提供了新功能的试错空间,支持边发布边进行优化。 2. 维持服务的连续性,实现无缝升级。 3. 针对不同用户群体实施功能区分,提升用户体验和满意度。 4. 收集用户反馈,为后续版本的功能迭代和优化提供指导。 然而,灰度发布同样面临挑战,例如技术实现的复杂性、增加的运维压力等。 四、灰度发布的具体实施策略 1. 建设目标:保证湖北联通对外服务的互联网程序能够实现7*24小时不中断的灰度发布,实现无缝升级,同时全面提升用户体验。 2. 总体说明:需要通过灰度发布实现迭代开发和版本快速更...

34,876

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧