How to write query to Delete the records in child table
and corresponding records in parent table
Answer Posted / surya
use this:
DELETE FROM childTable WHERE EXISTS(SELECT id FROM
parentTable WHERE parentTable .id = childTable .id where id = 1)
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
Write a SQL query to delete a table?
Can you explain what are the restrictions applicable while creating views? : SQL Server Architecture
Which tools are available to manage SQL Azure databases and servers?
How do users use Report Builder with SQL Server data sources?
What is a collation in ms sql server?
What is a data source or ds? : sql server analysis services, ssas
How to insert and update data into a table with "insert" and "update" statements?
How to create function without parameter in sql server?
What are different types of raid configurations? : SQL Server Architecture
What is the use of @@spid?
What is resource governor?
What is difference between inner join and full join?
What are subqueries in sql server?
in the physical file layout, where should the transaction log be stored in relation to the data file?
Can truncate be rolled back?