alter table stor.t_inventory_elements_remains alter column remains drop not null;

update stor.t_inventory_elements_remains  ier
set remains = null
from stor.t_inventory_elements ie
join stor.t_inventory_document id on id.inventorydocumentid = ie.inventorydocument
where ie.inventoryelementsid = ier.inventoryelements and id.status = 2;

update stor.t_scanned_inventory_elements ier
set remains = null
from stor.t_inventory_elements ie
join stor.t_inventory_document id on id.inventorydocumentid = ie.inventorydocument
where ie.inventoryelementsid = ier.inventoryelements and id.status = 2;