BEGIN TRANSACTION DELETE FROM core_item_tag WHERE tagged_id IN SELECT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
BEGIN TRANSACTION;
DELETE FROM core_item_tag WHERE tagged_id IN (SELECT itemId FROM core_items
WHERE itemNumber = 'Код номенклатуры из п. 3.1');
DELETE FROM core_items WHERE itemNumber = ''Код номенклатуры из п. 3.1';
if (@@ERROR <> 0)
begin
ROLLBACK TRANSACTION;
return;
end;
commit transaction;