Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Self Join Referential Integrity
Message
 
To
15/09/2011 11:11:35
General information
Forum:
Microsoft SQL Server
Category:
Database design
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01523616
Message ID:
01523641
Views:
37
>Should this do it:
>
>
CREATE TRIGGER PersonsDeleteDependents 
>   ON  Persons
>   FOR DELETE
>AS 
>BEGIN
>	-- SET NOCOUNT ON added to prevent extra result sets from
>	-- interfering with SELECT statements.
>	SET NOCOUNT ON;
>
>    -- Insert statements for trigger here
>    delete Persons
>    from Persons
>    inner join deleted on deleted.personid = persons.parentid
>
>END
>
>?

The trigger looks OK, but did you have recursive triggers enabled?
How many levels of parenting you may have?
What if you delete a child that has siblings?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform