deleting records from multiple tables at a time with a single query in sqlserver2005

Posted by sudhavamsikiran on Stack Overflow See other posts from Stack Overflow or by sudhavamsikiran
Published on 2010-04-23T06:09:21Z Indexed on 2010/04/23 6:13 UTC
Read the original article Hit count: 312

Filed under:
|

Hi

I wanna delete records from child tables as well as parent table with in a single query. please find the query given below. here response header is the primary table and responseid is the primary key.

DELETE FROM responseheader FROM responseheader INNER JOIN responsepromotion ON responseheader.responseid = responsepromotion.ResponseID INNER JOIN responseext ON responsepromotion.ResponseID=responseext.ResponseID WHERE responseheader.responseid In ('67D8B9E8-BAD2-42E6-BAEA-000025D56253')

but its throwing error . can any one help me to find out the correct query

© Stack Overflow or respective owner

Related posts about delete-row

Related posts about sql-server-2005