sql2000触发器问题

yaomeng2008 2008-07-01 10:43:17
sql2000触发器里面引用的表Aaa,老提示着不到A的列前缀,是怎么回事呀。。

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


ALTER TRIGGER pur_ship_ti ON dbo.pur_ship
FOR INSERT
AS
declare @iap int,@imp int,@stock_flag char(1),@vendor char(10),
@currency varchar(4),@exchange_rate float
select @iap=ap,@imp=mp from pur_parameter
declare @inter_inv float

select @inter_inv=inter_inv from pur_parameter

update pur_order_head
set a.order_status='R'
from pur_order_head a,
inserted b
where a.order_no=b.order_no

if @inter_inv<>-1

update pur_order_detail
set a.ship_qty=round(isnull(a.ship_qty,0)+isnull(b.ship_qty,0),@iap),
a.quality_qty=round(isnull(a.quality_qty,0)+isnull(b.quality_qty,0),@iap),
a.ship_date=b.ship_date

from pur_order_detail a,
inserted b
where a.order_no = b.order_no and
a.item_code = b.item_code and
a.request_date = b.request_date
else

update pur_order_detail
set a.ship_qty=round(isnull(a.ship_qty,0)+isnull(b.ship_qty,0),@iap),
a.ship_date=b.ship_date
from pur_order_detail a,
inserted b
where a.order_no = b.order_no and
a.item_code = b.item_code and
a.request_date = b.request_date

select @stock_flag=b.stock_flag,@vendor=b.vendor,@currency=b.currency,@exchange_rate=exchange_rate
from inserted a,pur_ship_head b
where a.bill_no=b.bill_no

if @stock_flag='1'
if exists(select * from pur_vendor_arrearage where vendor=@vendor and currency=@currency)
update pur_vendor_arrearage
set a.ship_amt=round(isnull(a.ship_amt,0)+isnull(b.ship_s_money,0),@imp)
from pur_vendor_arrearage a,inserted b
where a.vendor=@vendor and
a.currency=@currency

else
insert into pur_vendor_arrearage(vendor,currency,acp_amt,adv_amt,ship_amt,exchange_rate)
select @vendor,@currency,0,0,ship_s_money,@exchange_rate
from inserted



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
...全文
50 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yaomeng2008 2008-07-01
  • 打赏
  • 举报
回复
我试试
中国风 2008-07-01
  • 打赏
  • 举报
回复
  update pur_order_head
set a.order_status='R'

改為
update a
set a.order_status='R'


update pur_order_head
set order_status='R'

34,873

社区成员

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

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