-
How would you solve this?
Lets say I want to delete a record in tableA. tableA has 5 foreign key tables.
Before I delete the row in tableA, I want to make sure I dont get any foreign key violation error. I dont want to make a cascading delete, since the record should not be deleted if it has child records.
Of course I could check all those tables before the delete. Anybody know of a better approach?
Regards,
Stefan
-
How would you solve this? (reply)
When you create a foreign key constraint, if you specify ON DELETE NO ACTION, the delete will fail. SQL will check for you.
------------
Stefan at 9/5/01 7:28:22 AM
Lets say I want to delete a record in tableA. tableA has 5 foreign key tables.
Before I delete the row in tableA, I want to make sure I dont get any foreign key violation error. I dont want to make a cascading delete, since the record should not be deleted if it has child records.
Of course I could check all those tables before the delete. Anybody know of a better approach?
Regards,
Stefan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|