Groups > Interbase > Interbase SQL > Re: Delete data from all user tables




Re: Delete data from all user tables

Re: Delete data from all user tables
17 Mar 2008 07:28:11 -0700
Adalberto Baldini wrote:

> There is any suggestion how to do it other than I create mydelete
> sequence manually and maintain it in order ?

There is no way that I am aware of. You have to create your own script
that performs the deletes from the bottom of the RI tree upward.

-- 
Post Reply
Delete data from all user tables
Mon, 17 Mar 2008 09:16:03 +010
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 ?

Thanks
Post Reply
Re: Delete data from all user tables
Mon, 17 Mar 2008 11:51:35 -070
If you want to delete all data, the end result is just meta data. Why 
not just extract the meta data? Here's how to do it with isql:

isql -x yourdatabase -o somefile.ext -u user -pass password

Adalberto Baldini wrote:
> 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 ?
> 
> Thanks
Post Reply
Re: Delete data from all user tables
Mon, 17 Mar 2008 12:27:53 -040
"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) 
Post Reply
Re: Delete data from all user tables
Tue, 18 Mar 2008 10:23:33 +010
Quinn Wildman (CodeGear Developer Support) wrote:
> If you want to delete all data, the end result is just meta data. Why 
> not just extract the meta data? Here's how to do it with isql:
> 
> isql -x yourdatabase -o somefile.ext -u user -pass password
> 
> Adalberto Baldini wrote:
> 

>> I want to delete all data
----------------------
  of one company
----------------------
from all tables in DB.

Post Reply
about | contact