-- Automatisch generierte SQL-Statements für Node Predecessor Chains
-- Generiert aus: node.xlsx
-- Format: Mehrere Chains pro Node möglich (mit ; getrennt)

-- Predecessor Chain 1: AB (Chain 1 von 2)
-- Predecessors: WH_ULHA
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'AB')
);

DECLARE @chain_id_1 INT;
SET @chain_id_1 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ULHA'),
    @chain_id_1,
    1
);

-- Predecessor Chain 2: AB (Chain 2 von 2)
-- Predecessors: WH_STO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'AB')
);

DECLARE @chain_id_2 INT;
SET @chain_id_2 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO'),
    @chain_id_2,
    1
);


-- Predecessor Chain 3: HH (Chain 1 von 1)
-- Predecessors: WH_HH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'HH')
);

DECLARE @chain_id_3 INT;
SET @chain_id_3 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_HH'),
    @chain_id_3,
    1
);


-- Predecessor Chain 4: FGG (Chain 1 von 2)
-- Predecessors: WH_STO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FGG')
);

DECLARE @chain_id_4 INT;
SET @chain_id_4 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO'),
    @chain_id_4,
    1
);

-- Predecessor Chain 5: FGG (Chain 2 von 2)
-- Predecessors: BEZEE
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FGG')
);

DECLARE @chain_id_5 INT;
SET @chain_id_5 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'BEZEE'),
    @chain_id_5,
    1
);


-- Predecessor Chain 6: KWS (Chain 1 von 2)
-- Predecessors: WH_STO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'KWS')
);

DECLARE @chain_id_6 INT;
SET @chain_id_6 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO'),
    @chain_id_6,
    1
);

-- Predecessor Chain 7: KWS (Chain 2 von 2)
-- Predecessors: BEZEE
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'KWS')
);

DECLARE @chain_id_7 INT;
SET @chain_id_7 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'BEZEE'),
    @chain_id_7,
    1
);


-- Predecessor Chain 8: EGD (Chain 1 von 2)
-- Predecessors: WH_HH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'EGD')
);

DECLARE @chain_id_8 INT;
SET @chain_id_8 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_HH'),
    @chain_id_8,
    1
);

-- Predecessor Chain 9: EGD (Chain 2 von 2)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'EGD')
);

DECLARE @chain_id_9 INT;
SET @chain_id_9 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_9,
    1
);


-- Predecessor Chain 10: CTT (Chain 1 von 2)
-- Predecessors: WH_BAT3
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CTT')
);

DECLARE @chain_id_10 INT;
SET @chain_id_10 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BAT3'),
    @chain_id_10,
    1
);

-- Predecessor Chain 11: CTT (Chain 2 von 2)
-- Predecessors: WH_JEAN
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CTT')
);

DECLARE @chain_id_11 INT;
SET @chain_id_11 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_JEAN'),
    @chain_id_11,
    1
);


-- Predecessor Chain 12: LZZ (Chain 1 von 1)
-- Predecessors: WH_ROLO
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'LZZ')
);

DECLARE @chain_id_12 INT;
SET @chain_id_12 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ROLO'),
    @chain_id_12,
    1
);


-- Predecessor Chain 13: STR (Chain 1 von 1)
-- Predecessors: WH_ZBU
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'STR')
);

DECLARE @chain_id_13 INT;
SET @chain_id_13 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ZBU'),
    @chain_id_13,
    1
);


-- Predecessor Chain 14: VOP (Chain 1 von 1)
-- Predecessors: WH_BUD
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'VOP')
);

DECLARE @chain_id_14 INT;
SET @chain_id_14 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BUD'),
    @chain_id_14,
    1
);


-- Predecessor Chain 15: KOL (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'KOL')
);

DECLARE @chain_id_15 INT;
SET @chain_id_15 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_15,
    1
);


-- Predecessor Chain 16: LIPO (Chain 1 von 1)
-- Predecessors: WH_BUD
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'LIPO')
);

DECLARE @chain_id_16 INT;
SET @chain_id_16 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BUD'),
    @chain_id_16,
    1
);


-- Predecessor Chain 17: WH_ZBU (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ZBU')
);

DECLARE @chain_id_17 INT;
SET @chain_id_17 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_17,
    1
);


-- Predecessor Chain 18: WH_STO (Chain 1 von 1)
-- Predecessors: BEZEE
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_STO')
);

DECLARE @chain_id_18 INT;
SET @chain_id_18 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'BEZEE'),
    @chain_id_18,
    1
);


-- Predecessor Chain 19: WH_HH (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_HH')
);

DECLARE @chain_id_19 INT;
SET @chain_id_19 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_19,
    1
);


-- Predecessor Chain 20: CNSHA (Chain 1 von 6)
-- Predecessors: Shanghai
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

DECLARE @chain_id_20 INT;
SET @chain_id_20 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Shanghai'),
    @chain_id_20,
    1
);

-- Predecessor Chain 21: CNSHA (Chain 2 von 6)
-- Predecessors: Hangzhou
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

DECLARE @chain_id_21 INT;
SET @chain_id_21 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Hangzhou'),
    @chain_id_21,
    1
);

-- Predecessor Chain 22: CNSHA (Chain 3 von 6)
-- Predecessors: Yangzhong
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

DECLARE @chain_id_22 INT;
SET @chain_id_22 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Yangzhong'),
    @chain_id_22,
    1
);

-- Predecessor Chain 23: CNSHA (Chain 4 von 6)
-- Predecessors: Taicang
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

DECLARE @chain_id_23 INT;
SET @chain_id_23 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Taicang'),
    @chain_id_23,
    1
);

-- Predecessor Chain 24: CNSHA (Chain 5 von 6)
-- Predecessors: Jingjiang
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

DECLARE @chain_id_24 INT;
SET @chain_id_24 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Jingjiang'),
    @chain_id_24,
    1
);

-- Predecessor Chain 25: CNSHA (Chain 6 von 6)
-- Predecessors: JJ
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSHA')
);

DECLARE @chain_id_25 INT;
SET @chain_id_25 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'JJ'),
    @chain_id_25,
    1
);


-- Predecessor Chain 26: CNTAO (Chain 1 von 2)
-- Predecessors: Qingdao
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNTAO')
);

DECLARE @chain_id_26 INT;
SET @chain_id_26 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Qingdao'),
    @chain_id_26,
    1
);

-- Predecessor Chain 27: CNTAO (Chain 2 von 2)
-- Predecessors: Linfen
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNTAO')
);

DECLARE @chain_id_27 INT;
SET @chain_id_27 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Linfen'),
    @chain_id_27,
    1
);


-- Predecessor Chain 28: CNXMN (Chain 1 von 2)
-- Predecessors: Fuqing
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNXMN')
);

DECLARE @chain_id_28 INT;
SET @chain_id_28 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Fuqing'),
    @chain_id_28,
    1
);

-- Predecessor Chain 29: CNXMN (Chain 2 von 2)
-- Predecessors: LX
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNXMN')
);

DECLARE @chain_id_29 INT;
SET @chain_id_29 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'LX'),
    @chain_id_29,
    1
);


-- Predecessor Chain 30: INNSA (Chain 1 von 2)
-- Predecessors: Pune
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'INNSA')
);

DECLARE @chain_id_30 INT;
SET @chain_id_30 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Pune'),
    @chain_id_30,
    1
);

-- Predecessor Chain 31: INNSA (Chain 2 von 2)
-- Predecessors: Aurangabad
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'INNSA')
);

DECLARE @chain_id_31 INT;
SET @chain_id_31 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Aurangabad'),
    @chain_id_31,
    1
);


-- Predecessor Chain 32: INMAA (Chain 1 von 1)
-- Predecessors: Bangalore
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'INMAA')
);

DECLARE @chain_id_32 INT;
SET @chain_id_32 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Bangalore'),
    @chain_id_32,
    1
);


-- Predecessor Chain 33: CNSZX (Chain 1 von 1)
-- Predecessors: Shenzhen
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'CNSZX')
);

DECLARE @chain_id_33 INT;
SET @chain_id_33 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'Shenzhen'),
    @chain_id_33,
    1
);


-- Predecessor Chain 34: WH_BAT3 (Chain 1 von 1)
-- Predecessors: FRLEH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BAT3')
);

DECLARE @chain_id_34 INT;
SET @chain_id_34 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FRLEH'),
    @chain_id_34,
    1
);


-- Predecessor Chain 35: WH_JEAN (Chain 1 von 1)
-- Predecessors: FRLEH
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_JEAN')
);

DECLARE @chain_id_35 INT;
SET @chain_id_35 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'FRLEH'),
    @chain_id_35,
    1
);


-- Predecessor Chain 36: WH_ROLO (Chain 1 von 1)
-- Predecessors: ITGOA
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_ROLO')
);

DECLARE @chain_id_36 INT;
SET @chain_id_36 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'ITGOA'),
    @chain_id_36,
    1
);


-- Predecessor Chain 37: WH_BUD (Chain 1 von 1)
-- Predecessors: DEHAM
INSERT INTO node_predecessor_chain (
    node_id
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'WH_BUD')
);

DECLARE @chain_id_37 INT;
SET @chain_id_37 = SCOPE_IDENTITY();

INSERT INTO node_predecessor_entry (
    node_id,
    node_predecessor_chain_id,
    sequence_number
) VALUES (
    (SELECT id FROM node WHERE external_mapping_id = 'DEHAM'),
    @chain_id_37,
    1
);

