|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can anyone help me with setting up cascade deletes in a firebird database.
I am using Upscene's Database Workbench 2.8 for the database administration, and VB6 for the front-end application. I've tried to setup a foreign key constraint and selected cascade delete, however it does not seem to work. This is what i need to achieve; I have two tables; 1) Ranges (with three fields) RA_ID <-----Primary Key RA_NAME RA_DESC 2) Models (with four fields) MO_ID <-----Primary Key MO_NAME MO_DESC MO_RA_ID <----Foreign Key the models belong to a range, and the field MO_RA_ID indicates which range it belongs to and needs to be linked to RA_ID in the ranges table. If a range is deleted, all the models that belong to that range should also be deleted. Last edited by stevesoft : May 29th, 2006 at 10:11 AM. Reason: more info |
|
#2
|
|||||||||||
|
|||||||||||
|
This is a simple example:
sql Code:
sql Code:
sql Code:
it works (check your commits )
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
|
#3
|
||||||
|
||||||
|
This is the SQL i try to execute;
sql Code:
but then i get the following error; Quote:
|
|
#4
|
|||
|
|||
|
I Got It Working
I Deleted All The Data From Both Tables, Added The Foreign Key, Which This Time Did Not Give The Error. Then Re-generated All The Data Now It Seems To Work Ok. I Think I Must Of Had Some Corrupt Data In There ![]() |
|
#5
|
||||
|
||||
|
Quote:
Glad you got it working |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Cascade Deletes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|