之前所在的公司为了达到一个价格政策的实时修改,有时数据量是成千上万的,录入数据可是辛苦了自己,加班加点。

寻找金蝶技术支持,答复是可以。但说是属于二次开发要收费1000元,只保证你现在要修改的价格政策,如果以后要修改或增加要另外收费。真坑人

苦思冥想能不能有另外的方法可以解决,又本人对于SQL语言不精通。只能又重新看书学习SQL语言,又要了解金蝶数据库表。真苦。。。

一个星期后,终于结果出来了。

alter proc stkd_salejgfaadd
as
set nocount on
----新客户价格修改时将删除原价格方案中价格,然后重新加入
delete from icprcplyentry where fitemid in
(select t.fitemid from t_icitem t,icprcplyentry i where t.fitemid=i.fitemid
and t.f_128<>i.fprice)
----加入价格方案中不存在的产品
insert into icprcplyentry(finterid,fitemid,frelatedid,funitid,fcuryid,fprice,
fbegdate,fenddate,fchecked,findex)
select 3,fitemid,40005,funitid,1,f_128,
dateadd("day",-1,getdate()),cast('2100-01-01' as datetime),
1,1
from t_icitem
where f_128 is not null
and f_128<>0
and (fnumber like '2%' or fnumber like '3%')
and fitemid not in (select fitemid from icprcplyentry)
----查询本次加入结果
select t.fnumber,t.fname,i.fprice,i.fbegdate,i.fenddate
from icprcplyentry i
left join t_icitem t on i.fitemid=t.fitemid
where i.fbegdate>=dateadd("day",-2,getdate())
set nocount off

SQL语言确实历害,一秒搞定成千上万的数据。轻轻松松,SQL语言真好。