订单bom点击配置提示给定的关键字不在字典中(每日小分享)
问题:订单bom点击配置提示给定的关键字不在字典中,经查 ICOrderBOMChild 表中 FFullPath 列有部分为空
可按下面语句修复 ICOrderBOMChild 表中 FFullPath
SELECT * into ICOrderBOMChild1129 FROM ICOrderBOMChild
SELECT *,b= Row_Number() OVER (partition by finterid ORDER BY finterid ) into #liu FROM ICOrderBOMChild
update t1
set t1.FFullPath=replace(str(t2.b-1,6,0),' ','0')
from ICOrderBOMChild t1
join #liu t2 on t1.FInterID=t2.finterid and t1.FEntryID=t2.fentryid and t1.FLevel=t2.FLevel and t1.FItemID=t2.FItemID
where t1.FFullPath<> replace(str(t2.b-1,6,0),' ','0')
drop table #liu
update t2
set t2.fparentid=t1.fentryid
from ICOrderBOMChild t1
join (SELECT finterid,fentryid,fparentid, substring( FFullPath,0,len(FFullPath)-5) as FFullPath ,FFullPath as FFullPath1 FROM ICOrderBOMChild ) t2
on t1.finterid=t2.finterid and t1.FFullPath=t2.FFullPath
where t2.fparentid<>t1.fentryid
--我对楼主的语句做了一些改良,如执行楼主的语句不生效可执行我的这段
update ICOrderBOMChild set FFullPath=''
SELECT * into ICOrderBOMChild1129 FROM ICOrderBOMChild
SELECT *,b= Row_Number() OVER (partition by fentryid ORDER BY fentryid ) into #liu FROM ICOrderBOMChild
update t1
set t1.FFullPath=replace(str(t2.b-1,6,0),' ','0')
from ICOrderBOMChild t1
join #liu t2 on t1.FInterID=t2.finterid and t1.FEntryID=t2.fentryid and t1.FLevel=t2.FLevel and t1.FItemID=t2.FItemID
where t1.FFullPath<> replace(str(t2.b-1,6,0),' ','0')
drop table #liu
update t2
set t2.fparentid=t1.fentryid
from ICOrderBOMChild t1
join (SELECT finterid,fentryid,fparentid, substring( FFullPath,0,len(FFullPath)-5) as FFullPath ,FFullPath as FFullPath1 FROM ICOrderBOMChild ) t2
on t1.finterid=t2.finterid and t1.FFullPath=t2.FFullPath
where t2.fparentid<>t1.fentryid
drop table ICOrderBOMChild1129
亲测有效!谢谢楼主分享!!
{:5_150:}
订单bom点击配置提示给定的关键字不在字典中(每日小分享)
本文2024-09-16 16:15:43发表“k3wise知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3wise-8112.html