Results 1 to 4 of 4

Thread: deleting Ado recordset which is a foreign key in another table

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    17
    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?


  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    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...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    17
    I cannot delete the whole record from B, coz other fields in it is still needed.

    How to remove referential integrity?

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Alter table drop constraint whatever_the_foreign_key_is_called

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width