create trigger tri_chuku on t_BOS200000089
for insert
as
declare @fid int ;
select @fid = fid from inserted ;
declare @inid int
set @inid=(select max(finterid) from icstockbill )+1
insert into icstockbill (fbrno,finterid,ftrantype,fdate,fbillno,fsupplyid,fsalestyle,FFManagerID,fdcstockid,fsmanagerid,FFetchAdd,fmulticheckstatus,fdeptid,fempid)
select 0,@inid,21 ,t.fdate,t.fbillno,t.fbase2 as '购货单位' ,t.fbase3 as '销售方式',t.fbase4 as '发货',
t.fbase5 as '发货仓库',t.fbase7 as '保管',t.fbase11 as '发货地点' ,t.fmulticheckstatus as '审核',
o.fdepartment as 部门,o.femployee as '业务员'
from t_BOS200000089 t, t_organization o where t.fbase2=o.fitemid
group by t.fdate,t.fbillno,t.fbase2,t.fbase3,t.fbase4,t.fbase5,t.fbase7,t.fbase11,t.fmulticheckstatus ,
o.fdepartment,o.femployeeinsert into icstockbillentry (fbrno,finterid,fentryid,fitemid,funitid,fauxqty,fconsignprice,fconsignamount,fdcstockid)
select 0,@inid,t1.fentryid,fbase1 as '物料',it.funitid as '单位',fdecimal18 as '数量' ,famount,famount1,fbase9
as '仓库' from t_BOS200000089entry t1,t_icitem it
where t1.fbase1=it.fitemid and t1.fid=@fid
这个哪有问题,为什么第二个insert不执行呢,谢谢!
for insert
as
declare @fid int ;
select @fid = fid from inserted ;
declare @inid int
set @inid=(select max(finterid) from icstockbill )+1
insert into icstockbill (fbrno,finterid,ftrantype,fdate,fbillno,fsupplyid,fsalestyle,FFManagerID,fdcstockid,fsmanagerid,FFetchAdd,fmulticheckstatus,fdeptid,fempid)
select 0,@inid,21 ,t.fdate,t.fbillno,t.fbase2 as '购货单位' ,t.fbase3 as '销售方式',t.fbase4 as '发货',
t.fbase5 as '发货仓库',t.fbase7 as '保管',t.fbase11 as '发货地点' ,t.fmulticheckstatus as '审核',
o.fdepartment as 部门,o.femployee as '业务员'
from t_BOS200000089 t, t_organization o where t.fbase2=o.fitemid
group by t.fdate,t.fbillno,t.fbase2,t.fbase3,t.fbase4,t.fbase5,t.fbase7,t.fbase11,t.fmulticheckstatus ,
o.fdepartment,o.femployeeinsert into icstockbillentry (fbrno,finterid,fentryid,fitemid,funitid,fauxqty,fconsignprice,fconsignamount,fdcstockid)
select 0,@inid,t1.fentryid,fbase1 as '物料',it.funitid as '单位',fdecimal18 as '数量' ,famount,famount1,fbase9
as '仓库' from t_BOS200000089entry t1,t_icitem it
where t1.fbase1=it.fitemid and t1.fid=@fid
这个哪有问题,为什么第二个insert不执行呢,谢谢!
select 0,@inid,t1.fentryid,fbase1 as '物料',it.funitid as '单位',fdecimal18 as '数量' ,famount,famount1,fbase9
as '仓库' from t_BOS200000089entry t1,t_icitem it
where t1.fbase1=it.fitemid and t1.fid=@fid
我怀疑@fid 没有值传过来
as '仓库' from t_BOS200000089entry t1,t_icitem it
where t1.fbase1=it.fitemid and t1.fid=10140 10000 28 731 641 3.0000000000 1.0000000000 5.0000000000 269
0 10000 29 733 641 4.0000000000 2.0000000000 6.0000000000 271
1014 200000089 GC2012022715 1002 4557 2012-02-27 00:00:00.000 10BOS200000089表的内容,哪位帮看看,哪错了,或者怎么调试