Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to delete a record which is referential to oth

Author  Topic 

allan8964
Posting Yak Master

249 Posts

Posted - 2008-06-06 : 11:53:42
Hi, I tried to delete a record in tblA which has an ID in tblB, i got error msg saying referential problem, please tell me what should i do? thanks.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-06 : 11:56:32
You should delete corresponding records in tblB and then delete the same in tblA

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-06 : 11:58:55
Another alternative is to use ON DELETE CASCADE option while defining the FOREIGN KEY constraint
Go to Top of Page
   

- Advertisement -