|
-
Jan 13th, 2000, 01:44 AM
#1
Thread Starter
New Member
Hi,
I am using diagrams in Sql 7 to connect some tables one to anoher. (Father table and sons) Like I was doing with access.
When I am trying to delete the Father record
I am getting error.
What is the appropriate syntax to do so?
Thanks,
Gil
-
Jan 13th, 2000, 01:47 AM
#2
Guru
did you (indirectly or directly) add a constraint to your tables so that a parent record must correspond to each child record?
-
Jan 13th, 2000, 06:01 AM
#3
Thread Starter
New Member
If you mean the constraint that appear in the table folder then no. I don't know what to write there.
Gil
-
Jan 13th, 2000, 06:12 AM
#4
Frenzied Member
You can write a trigger to issue a delete on the child...
-
Jan 13th, 2000, 01:08 PM
#5
Lively Member
this could be because of referential integrity. You are trying to delete a record in the father table which is used by the child. So when you delete, make sure it is a cascade delete.
-
Jan 13th, 2000, 05:14 PM
#6
Thread Starter
New Member
Thank you all.
1. How do I write triggers for this missions?
2. What is a cascade delete?
I tried to look in the sql documentation but I didn't find any. Does anyone know where it is in the documentation?
Gil
-
Jan 14th, 2000, 02:46 AM
#7
Frenzied Member
You'll have to write the triggers to support a cascade delete (SQL Server 6.5 doesn't have cascade deletes, not sure about 7.0 but I suspect it doesn't also).
A cascade delete deletes records in associated tables when you issue a delete on one or more tables. The term comes from hierarchical databases that have parent-child structures. Hierarchical databases, for the most part, lost out to relational databases in the secret database wars.
As an example, a delete trigger might look like:
CREATE TRIGGER CascadeExample
ON table1
FOR DELETE
AS
Delete table2 from deleted a, table2 b
where a.uniquekey=b.uniquekey
-
Jan 16th, 2000, 04:50 PM
#8
Thread Starter
New Member
Thanks,
The Cascade delete works.
But I still have problems with the diagrams.
Meanwhile I disconnect them but I don't think that it is the right solution.
I am still looking for a way to prevent errors while performing delete within connect tables.
Gil
-
Jan 16th, 2000, 11:51 PM
#9
Guru
If the cascade delete works, what error messages are you getting?
-
Jan 17th, 2000, 01:44 AM
#10
Frenzied Member
You will need to add a trigger for every table that has RI to the one you're deleting.
-
Jan 20th, 2000, 06:18 PM
#11
Thread Starter
New Member
The error I am getting is: DELETE statement conflicted with COLUMN REFERENCE constraint...
I need the diagrams for automatic update between tables as it is in access.
If I have to write triggers then I don't think that I need the diagrams.
Gil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|