Jump to content

Recommended Posts

violation of FOREIGN KEY constraint "INTEG_618" on table "SOITEM"

Foreign key reference target does not exist

 

INSERT INTO SOITEM (SOITEM.ID, SOITEM.PRODUCTID, SOITEM.SOID, SOITEM.TYPEID, SOITEM.STATUSID, SOITEM.UOMID, SOITEM.SOLINEITEM, SOITEM.DESCRIPTION, SOITEM.PRODUCTNUM, SOITEM.CUSTOMERPARTNUM, SOITEM.TAXABLEFLAG, SOITEM.QTYTOFULFILL, SOITEM.QTYFULFILLED, SOITEM.QTYPICKED, SOITEM.DATELASTFULFILLMENT, SOITEM.DATESCHEDULEDFULFILLMENT, SOITEM.REVLEVEL, SOITEM.REPAIRFLAG, SOITEM.TBDPRICEFLAG, SOITEM.EXCHANGESOLINEITEM, SOITEM.QBCLASSID, SOITEM.NOTE, SOITEM.SHOWITEMFLAG, SOITEM.ITEMADJUSTID, SOITEM.UNITPRICE, SOITEM.TOTALPRICE, SOITEM.ADJUSTAMOUNT, SOITEM.TOTALCOST) 
SELECT '1459', '991', SOITEM.SOID, '20', SOITEM.STATUSID, SOITEM.UOMID, '3', 'Restocking Fee', 'Restocking Fee', SOITEM.CUSTOMERPARTNUM, SOITEM.TAXABLEFLAG, SOITEM.QTYTOFULFILL, SOITEM.QTYFULFILLED, SOITEM.QTYPICKED, SOITEM.DATELASTFULFILLMENT, SOITEM.DATESCHEDULEDFULFILLMENT, SOITEM.REVLEVEL, SOITEM.REPAIRFLAG, SOITEM.TBDPRICEFLAG, SOITEM.EXCHANGESOLINEITEM, SOITEM.QBCLASSID, SOITEM.NOTE, SOITEM.SHOWITEMFLAG, SOITEM.ITEMADJUSTID, '29.74', '29.74', SOITEM.ADJUSTAMOUNT, SOITEM.TOTALCOST
FROM SOITEM
WHERE SOITEM.ID = '116'

 

Excuse it for being so long and seeming to be a mess, it's only going to be manually ran once and never again. What could be causing this error?

Link to comment
https://forums.phpfreaks.com/topic/188106-violation-of-foreign-key-constraint/
Share on other sites

There's a foreign key restraint defined on this table, which means a record in this table cannot exist without a record it references to in some other table. Use SHOW CREATE TABLE SOITEM to check what constraints are defined in this table.

Oh man that's gonna really suck. I'm having to add a line to an order for something and I'm gonna have to track all the foreign keys down to the roots and all in sql. The database tool has a tab showing foreign keys, so I can just go by that but this should take a little while. :( There's 7 of them for this table, and I bet there's more on the others.

Okay turned out I had a number wrong, changed it and matched up correctly. Now I get a new error though:

 

violation of PRIMARY or UNIQUE KEY constraint "INTEG_617" on table "SOITEM"

 

 

and with what I'm using you can't use show:

Token unknown - line 1, column 1

SHOW

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.