Y2H
Y2H

Reputation: 2537

SQL Insert Code Not Working

I am trying to execute the following SQL code on SQL Server, but 0 rows are affected.

INSERT INTO IV10201 (ITEMNMBR, TRXLOCTN, QTYTYPE, DOCDATE, RCTSEQNM, ORIGINDOCTYPE, ORIGINDOCID, LNSEQNBR, CMPNTSEQ, QTYSOLD, UNITCOST, IVIVINDX, IVIVOFIX, SRCRCTSEQNM, TRXREFERENCE, PCHSRCTY)
    SELECT 
        ITEMNMBR, TRXLOCTN, QTYTYPE, DOCDATE, 218, 
        ORIGINDOCTYPE, ORIGINDOCID, LNSEQNBR, CMPNTSEQ, 15.500000,
        UNITCOST, IVIVINDX, IVIVOFIX, 0, TRXREFERENCE, PCHSRCTY
    FROM 
        IV10201 
    WHERE 
        itemNmbr = 'N-LB-00039-0015-0004' 
        AND trxLoctn = 'KATAMYA' 
        AND qtyType = 1 
        AND docDate = '2016-02-08 00:00:00' 
        AND rctseqnm = 157 
        AND srcrctseqnm = 64

I am not getting any error messages, just that 0 rows were affected. Any idea what is the problem with my code?

Thank you!

Upvotes: 1

Views: 69

Answers (1)

Evaldas Buinauskas
Evaldas Buinauskas

Reputation: 14077

Well, your select query does not return anything, that's your problem most likely. Try running your query without insert and see what results you get.

Upvotes: 1

Related Questions