Click here to Skip to main content
15,904,346 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi 2 all ,

I have a problem . i have a foreign key on my table . but the other table which related t this foreign key as a primary key has been deleted already . now i want to remove this foreign key .. but nothing happen ...
how can i delete this key .. pls tell me frnds ....

in detail

my table name is centerinfo
and foreign key on this table is "FK__TargetInf__Cente__0777106D"

and the table which related to this with primary -foreign key relation is "targetinfoold"

and this table(targetinfoold) already deleted ...

how to delete this foreign key now
?
Posted
Comments
phil.o 6-Sep-13 2:35am    
Please tag it correctly to the database system concerned (MySQL, SQL Server, PostGRE...) instead of ASP.NET ; this cannnot be an ASP.NET problem.
And please give us more details on both tables and fields involved in the process (nullable or not, cascade mode, etc.).
GDdixit 6-Sep-13 6:00am    
OK ...
These are foreign keys ...


Table is referenced by foreign key ..

mfapp403_500db.dbo.[targetinfoold]: FK__TargetInf__Cente__0777106D
mfapp403_500db.dbo.ClientCRTReportInfo: FK__ClientCRT__Cente__7EE1CA6C
mfapp403_500db.dbo.DayOpenDayCloseInfo: FK__DayOpenDa__Cente__1C1D2798
mfapp403_500db.dbo.SubgroupInfo: FK__SubgroupI__Cente__058EC7FB
mfapp403_500db.dbo.targetinfOld2: FK__TargetInf__Cente__41399DAE
mfapp403_500db.dbo.TempPaymentShceduleInfo: FK__TempPayme__Cente__297722B6


in this first one i.e. "mfapp403_500db.dbo.[targetinfoold]: FK__TargetInf__Cente__0777106D"

has the relationship with the table "targetinfoold" . and this table (targetinfoold) already deleted from my database ...
and now when tried to delete some data from my " centerinfo " .. it can not be possible ..

how to solve this ...i hope u understand ...
phil.o 6-Sep-13 6:24am    
More clear ; but I'm still waiting for knowing which database system ^^

ALTER TABLE centerinfo DROP FOREIGN KEY "FK__TargetInf__Cente__0777106D" use this query . i think it is correct so just try but not in 100%.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900