DROP PROCEDURE Tmp_In_IntraItemDelTodoProc
GO
CREATE PROCEDURE Tmp_In_IntraItemDelTodoProc
(
  @CORRNBR  INT)
AS
BEGIN
    BEGIN TRAN

    DELETE
      FROM Tmp_In_IntraItem
     WHERE CORRNBR=@CORRNBR

    IF (@@error!=0)
    BEGIN
        RAISERROR  20002 'TMP_IN_INTRAITEMTodoDelProc: Cannot delete because foreign keys still exist in TMP_IN_INTRAITEM '
        ROLLBACK TRAN
        RETURN(1)
    
    END

    COMMIT TRAN

    RETURN(0)
END