Unanswered: Suppress foreign key error message during delete
Hi fellow db scripters,
I have a stored procedure that deletes a row from one table that has a foreign key relationship. How can i use the DELETE command then suppress/catch the error messages if the row that is being deleted violates the foreign key relationship.
You can check the other table for the entry before trying the delete - but if it is a multi-user system that won't stop someone else adding an entry between the check and the delete unless you lock the table.
You could use an instead of trigger to do this.
Your application has attempted an operation that violates the database integrity and so will generate an error.
Its ok to check the table for deleting, but what I'm concern on is if there are two many table that has a foriegn key relation with this table. Or maybe there would additional tables that would be related to this table. For now I'll do the cross checking before delete. Thanks!