-
cascade delete
Hi! I must delete rows in cascade and I know that I can use triggers but I
don't know how to built the triggers.
Please, I need some help.
Thanks in advance!!!
Marian
-
Re: cascade delete
"Marian" <mrsebedio@hispanoamericana.com.ar> wrote:
>
>Hi! I must delete rows in cascade and I know that I can use triggers but
I
>don't know how to built the triggers.
>Please, I need some help.
>Thanks in advance!!!
>Marian
What DBMS and version are you using?
Dennis
-
Re: cascade delete
"Dennis" <DennisRehm@AppliedComputing.net> wrote:
>
>"Marian" <mrsebedio@hispanoamericana.com.ar> wrote:
>>
>>Hi! I must delete rows in cascade and I know that I can use triggers but
>I
>>don't know how to built the triggers.
>>Please, I need some help.
>>Thanks in advance!!!
>>Marian
>
>What DBMS and version are you using?
>
>Dennis
SQL Server 7.0
-
Re: cascade delete
"Marian" <mrsebedio@hispanoamericana.com.ar> wrote:
>
>
>
>"Dennis" <DennisRehm@AppliedComputing.net> wrote:
>>
>>"Marian" <mrsebedio@hispanoamericana.com.ar> wrote:
>>>
>>>Hi! I must delete rows in cascade and I know that I can use triggers but
>>I
>>>don't know how to built the triggers.
>>>Please, I need some help.
>>>Thanks in advance!!!
>>>Marian
>>
>>What DBMS and version are you using?
>>
>>Dennis
>SQL Server 7.0
When you move to SQL Server 2000, you will be able to do cascading deletes
easily. In SQL Server 7.0-
Do not define a foreign key relationship between the table where the delete
occurs and the table where the delete will cascade. The foreign key constraint
will generate an error before the trigger can fire. If you want referential
integrity, it will need to be in the trigger, too.
Look at Books Online under Trigger - Create. It will explain the syntax.
It will be something like:
CREATE TRIGGER triggername ON table_a
FOR DELETE
AS
delete from table_b
from deleted
where table_b.key = deleted.key
Dennis
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks