I work on SQL server 2012 I face issue I can't insert mapped to into table trade codes where mapped from exist on table trade code
so firstly I will get MapCodeTypeFrom and MapCodeValueFrom from table settings
second i will search on table tradecodes for MapCodeTypeFrom and MapCodeValueFrom
if MapCodeTypeFrom and MapCodeValueFrom exist on table trade Codes
then add MapCodeTypeTo and MapCodeValueTo for every part
that meaning every part have MapCodeTypeFrom and MapCodeValueFrom on table TradeCodes must have MapCodeTypeTo and MapCodeValueTo
with another meaning every part must have two rows first row for MapCodeTypeFrom and MapCodeValueFrom second row for MapCodeTypeTo and MapCodeValueTo