Controling the Deletion of records

dbmanalser84

Registered User.
Local time
Today, 20:46
Joined
Feb 26, 2008
Messages
52
I have two tables which are connected with one to many relation, here are these tables:

tblCars
PK. intCarID
txtModelName
intManufacturerID
intModelPrice

tblManufacturer
PK. intManufacturerID
txtName
txtAdress
txtTelephone

Now, how do I achieve that when I delete a Car from the database, the Manufacturer is not deleted, because as you know one Manufacturer can create several model of cars, but when I delete Manufacturer all the cars from that Manufacturer are deleted? I know I need to enable cascade Delete but when I do that in each case when I delete a record from one database its relational record from the other table is deleted. How do I acomplish this?
 
Why bother to delete a manufacturer (or a car)? Why not have a field where they are either active or inactive. Then in any queries, you can include or exclude them as you wish.

Col
 
Yes

Why bother to delete a manufacturer (or a car)? Why not have a field where they are either active or inactive. Then in any queries, you can include or exclude them as you wish.

Col

Yes, thats one of the possibilities and it's interesting, but I wan't to know how to do this the way I wanted because I need to do it that way. Thnx

P.S. - Does this has something to do with the way Join type in the relation is specified?
 
Last edited:
in realtionship view, join the tables - right click the line, and select enforce referential integrity

then it will do what you want

be careful -cascading deletes are pretty dangerous
 

Users who are viewing this thread

Back
Top Bottom