I have 3 tables
ParentTableChildTable(with columnParentIdrefering toParentTable)Recording(with columnParentIdrefering to own table)
Parent table has a trigger which adds a row into the Recording table.
Child table again has a trigger that appends row in Recording table
Now I get an error that the row was not found in Recording table
The INSERT statement conflicted with the FOREIGN KEY SAME TABLE
constraint
You might be triggering a duplicate ParentID to be inserted into the Recording table. This would be true if your ParentID in the Recording table has a unique key defined on it.
When inserting into the Parent table, you insert a record with a ParentID into Recording. I think your insert a duplicate ParentID on the ChildTable trigger.
Maybe you can provide some more context.
Also, you might want to avoid triggers if possible – which it is most of the time. Using CTE’s and OUTPUT clauses this can help you avoid issues with triggers.