Script T-SQL per canviar la segmentació d’un model a Apparel & Footwear

declare @model nvarchar(50) = 'CARTE-0002'

--select * from [@ARGNS_MODEL] where U_ModCode=@model

update [@ARGNS_MODEL] set U_ATGrp=1,U_SclCode='005',U_SclPOM='005' where U_ModCode=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM1 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM2 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM3 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM4 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM5 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM6 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM7 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM8 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM9 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM10 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM11 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM12 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update IT set IT.ItemCode=IT.ItemCode+'-UN' 
from ITM13 IT 
join OITM OIT on OIT.ItemCode=IT.ItemCode and OIT.U_ARGNS_MOD=@model

update OITM set ItemCode=ItemCode+'-UN' where U_ARGNS_MOD=@model

update DLN1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model
update INV1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model
update RIN1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model
update RDN1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model
update RDR1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model
update WTR1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model
update IGN1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model
update IGE1 set ItemCode=ItemCode+'-UN' where U_ARGNS_MODCODE=@model