in Education by
I have the following table relationship in my database: Parent / \ Child1 Child2 \ / GrandChild I am trying to create the FK relationships so that the deletion of the Parent table cascades to both child and the grandchild table. For any one particular granchild, it will either be parented to one or the other child tables, but never both at the same time. When I'm trying to add ON DELETE CASCADE to the FK relationships, everything is fine adding them to one "side" of the two children (Parent-Child1-GrandChild is fine for Cascade Delete). However, as soon as I add the Cascade Delete on the Child2 "side" of the relationship SQL tells me that the FK would cause multiple cascade paths. I was under the impression that multiple cascade paths only apply when more than one FK indicates the SAME table. Why would I be getting the multiple cascade paths error in this case? PS The table relationships at this point would be very difficult to change so simply telling me to change my table structure is not going to be helpful, thanks. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The message means that if you delete a Parent record, there are two paths that lead to all deletable GrandChild records. Fix: Remove the ON DELETE CASCADE options in the FKs, and create INSTEAD OF DELETE triggers for the ChildX tables, deleting all grandchild records, and then the childX records themselves.

Related questions

0 votes
    I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the ... of the management studio.) Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    I need to synchronize two tables. TableA Id Name TableB Id Name RefID --It's a Foreign key, defined as ... MATCHED BY TARGET THEN. Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I need to synchronize two tables. TableA Id Name TableB Id Name RefID --It's a Foreign key, defined as ... MATCHED BY TARGET THEN. Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    How can a column with a default value be added to an existing table in SQL Server 2000 / SQL Server 2005? Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    I would like to ask for performance of SQL. This is my query: Select A.code ,A.name ,(Select B. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    Get all Users from first table that have any word matching in another table; I have Users table that ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    Get all Users from first table that have any word matching in another table; I have Users table that ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I am trying to run the following SQL: INSERT INTO Suppliers ( [SupplierID], [CompanyName]) Select [SupplierID], [ ... is very slow. Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [ ... not supply any columns. Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    It's easy to find duplicates with one field: SELECT name, COUNT(email) FROM users GROUP BY email HAVING COUNT( ... to find them first. Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    Academia has it that table names should be the singular of the entity that they store attributes of. I dislike any ... or should I go? Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    Consider a database table holding names, with three rows: Peter Paul Mary Is there an easy way to turn this into ... Peter, Paul, Mary? Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    I have multiple set of data to insert at once, say 4 rows. My table has three columns: Person, Id and ... a single SQL statement? Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    I have multiple set of data to insert at once, say 4 rows. My table has three columns: Person, Id and ... a single SQL statement? Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    I tried to implement Ngrx into my Angular Application, but sadly haven't been able to retrieve any data. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
...