PDA

Click to See Complete Forum and Search --> : deleting Ado recordset which is a foreign key in another table


titanium
Mar 18th, 2000, 10:41 PM
I like to delete a record from table A, which is a foreign key in table B (ie. the record is Primary Key in A but not in B). When I tried to delete, it gives me an error message which says somethings like "cannot be deleted causes it is related to table B". How do I delete the record in A?

JHausmann
Mar 18th, 2000, 11:27 PM
In some DBMS packages, you have the option to "cascade delete". This, basically, deletes all foreign keys then the primary. You'll need to delete the record(s) from table B (and any other table that uses table A as a foreign key) _or_ remove referential integrity...

titanium
Mar 19th, 2000, 01:14 AM
I cannot delete the whole record from B, coz other fields in it is still needed.

How to remove referential integrity?

JHausmann
Mar 19th, 2000, 10:37 PM
Alter table drop constraint whatever_the_foreign_key_is_called