Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 cascade delete without FK (SQL Server 7)

Author  Topic 

dinbougre
Starting Member

2 Posts

Posted - 2001-12-04 : 08:42:10
I use Visual Basic and in my program I made a delete on the database
when I delete a record I want the trigger to look in another table in order to delete every record which was link to the deleted record

my code is:


[g]CREATE trigger t_entite_delete on t_entite
for delete
as
begin

delete
t_role
from
deleted d,t_role t
where t.entite_id = d.obj_id

end[/g]

It works when the trigger delete one record but when he has to delete more than one he stop and tell me that too much row were concerned, so how to do? what is the problem?

I read all old topic about cascade delete but my case is without FK the error message is that too much rows are concerned by the update (but I want to delete not to update)



johnsoar
Yak Posting Veteran

66 Posts

Posted - 2001-12-04 : 22:22:20
Is entite_id unique? Usually this stems from trying to delete from a table where the column used in the join(entite_id ) is not unique. To many rows match the join criteria.
You should change the join to use a column who's values are unique. If this is not the case, post the sql-error to give us a better idea of what the actual problem is.

Adam
Go to Top of Page
   

- Advertisement -