🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #438

Re: Delete data from all user tables

#438
From: Wayne Niddery (TeamB)
Date: Mon, 17 Mar 2008 16:27
25 lines
2233 bytes
"Adalberto Baldini" <finman@swissonline.ch> wrote in message 
news:47de28be$1@newsgroups.borland.com...
>I want to delete all data of a company from all tables in DB.
> As foreign keys relate each other I had tried to set feature OnDelete 
> cascade, starting delete from Table Company.
> It doesn't work because the order delete processes tables conflicts with 
> foreign keys integrity.
>
> There is any suggestion how to do it other than I create mydelete sequence 
> manually and maintain it in order ?


It may be difficult to figure out where the issue is, but theoretically, a 
proper combination of FKs with cascaded deletes should not conflict. 
Basically the cascade delete constraint needs to also be defined down the 
entire chain. If it is not defined at any point, then the FK from a lower 
level will stop the entire delete.

If you cannot resolve that, then the olny option is a manual script - or 
stored proc - that is able to follow the chain down to the bottom and delete 
its way back up.

-- 
Wayne Niddery - TeamB (www.teamb.com)
Winwright, Inc. (www.winwright.ca) 
Technical Details
Message-ID: <47de9c16$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47de28be$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,129e16198f438d12
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Wayne Niddery \(TeamB\)" <wniddery@chaffaci.on.ca>
Newsgroups: borland.public.interbase.sql
References: <47de28be$1@newsgroups.borland.com>
In-Reply-To: <47de28be$1@newsgroups.borland.com>
Subject: Re: Delete data from all user tables
Date: Mon, 17 Mar 2008 12:27:53 -0400
Lines: 26
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6000.16480
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545
NNTP-Posting-Host: 24.137.214.213
Message-ID: <47de9c16$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1205771286 24.137.214.213 (17 Mar 2008 09:28:06 -0700)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail