Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created database. all tables are created. but in some tables I forget to give cascade for foreign key on delete and on update. There is no data.. Is it possible to give cascade to foreign key without effecting table relations?? Plz help me..
Thanks In advance..

What I have tried:

I tried to giving cascade in a table but by do this it removes all relation in which this key is used..
Posted
Comments
[no name] 5-Feb-16 3:52am    
If you don't have any data in your table why don't you re-create it with all relations with cascading property.
heta.dave 5-Feb-16 4:04am    
recreation of all relation will be time consuming.. That is last option for me but I search for other solution if any...
jaket-cp 5-Feb-16 4:17am    
How did you try to add the cascade?

You should be able to remove the Foreign Key constraint and then add it back with the on delete cascade or on update cascade

Have a read of
https://msdn.microsoft.com/en-us/library/ms175493.aspx

which in turn you should read
https://msdn.microsoft.com/en-us/library/ms189579.aspx
and then
https://msdn.microsoft.com/en-us/library/ms189049.aspx
dharan1990 9-Feb-16 7:21am    
You can make use of GUI..
http://stackoverflow.com/questions/4454861/how-do-i-edit-a-table-in-order-to-enable-cascade-delete......

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