sql2000触发器问题
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