When doing cascading deletes  you have to order thing outside-in. ie. the
child entities have to go before their parents otherwise you'll be violating
integrity constraints in the children when you remove the parent.

I assume that's what's happening here.

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Niraj Soni
> Sent: Monday, April 23, 2001 7:47 AM
> To: [EMAIL PROTECTED]
> Subject: off topic -- cascade delete in sql ---help
>
>
> hi all
>
> sorry for off topic question
>
> i have three table
>
> table1
> -----------
> parent_id
> parent_name
>
>
> table2
> ---------
> child_id
> child-name
> parent_id (referene table1.parent_id)
>
>
> table3
> --------
> clild_child_id
> child_child_name
> child_id (reference table2.child_id)
>
>
> now i want to update table1
> when table1 update all related records from table2 and table3 should be
> deleted
> and new records would be enterd
>
> but when i call
> execute method of prepared statement it gives sql exception
> java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL
> Server]DELETE
> statement conflicted with COLUMN REFERENCE constraint 'FK_table1_table2'
>
> my query is delete from table1 where parent_id=001
>
>
> have any one idea how to do cascade delete
>
> i am using MSSQL7.0 on WIN NT
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to