Danish Habib

Danish Habib

  • NA
  • 694
  • 244.1k

SQL Server Reference Deletion of the Record Need Help

Nov 11 2014 1:07 AM
Dear I have Three Tables Districts,Tehsils,Ucs
District(DistrictId(Pk),DistrictName) 
Tehsils(TehsilId(PK),TehsilName,DistrictID(FK))
UC(UCID(PK),UCNAME,TEhsilID(FK),DistrictID(FK))
Now I have relational Database the UC table has the  reference key of DistrictID and tehsil id,same as the tehsils table has the districtId as forign key when i am deleting the tehsil it does not give error of reference key in some other table but when i delete the uc it gives an error that this is reference to some other table as  well ,so delete the primary record first (in my case if i insert a one uc wrong which is associated with some tehsil if i delete teh tehsil first the many other ucs are also associated with this tehsil so i do not want to delete the tehsil because many other ucs are also related with that.
please help  

Answers (1)