I specifically pay attention to the order. So I delete from the child first, then parent table.
But I still get the error, I also tried to reverse the order, I get the same message.
The table and forign key scripts are in the attachment.
The delete statement I run is like below:
PRINT 'DELETING FROM batSchoolRangeProgramResult'
DELETE a
FROM [Assignment_4122012].[dbo].[batSchoolRangeProgramResult] a
JOIN @ProcessIDToClean b ON a.ProcessID = b.ProcessID
WHERE createdby = @createdby
AND schoolyear = @SchoolYearToClean
PRINT 'DELETING FROM appSchoolRangeProgramSnapshot'
DELETE a
FROM [Assignment_4122012].[dbo].[appSchoolRangeProgramSnapshot] a
JOIN @ProcessIDToClean b ON a.ProcessID = b.ProcessID
WHERE createdby = @createdby
AND schoolyear = @SchoolYearToClean