GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  SQL Server
Go To First  |  Previous Question  |  Next Question 
 SQL Server  |  Question 37 of 60    Print  
How to delete records from two tables. There is relationship between two tables.
It's working in MySQL but not in SQL-Server.


  
Total Answers and Comments: 3 Last Update: December 14, 2007     Asked by: kathir 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: vijaya_pitta
 
when  ON DELETE CASCADE  is mention in the table while creating them, then
 if we use delete command in one table then it affects the other table also,

i think this is correct,
u try it out.

Above answer was rated as good by the following members:
venkateswarlu.net
December 01, 2007 13:56:26   #1  
vasumathi.sridharan Member Since: November 2007   Contribution: 1    

RE: How to delete records from two tables. There is relationship between two tables.
First delete records from the table that has the foreign key reference(child table). Then delete the parent table.
 
Is this answer useful? Yes | No
December 12, 2007 02:29:39   #2  
vijaya_pitta Member Since: August 2007   Contribution: 3    

RE: How to delete records from two tables. There is relationship between two tables.
when  ON DELETE CASCADE  is mention in the table while creating them, then
 if we use delete command in one table then it affects the other table also,

i think this is correct,
u try it out.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
December 14, 2007 09:47:50   #3  
caveatashish Member Since: October 2007   Contribution: 3    

RE: How to delete records from two tables. There is relationship between two tables.

Use a procedure which will delete record from child table first and then it will delete the same record from parent table

Same thing can be achieved using cascade delete and cascade update, this feature was not there in sql server 7.0


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape