Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Location
    Philippines
    Posts
    2

    Smile 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.

    Thanks in advance

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    You can't.
    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.

  3. #3
    Join Date
    Sep 2003
    Location
    Philippines
    Posts
    2
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •