Subject Re: [firebird-support] Re: Insert succesfull while violating primary key constraint
Author Svein Erling Tysvaer
At 14:06 19.06.2003 +0000, you wrote:
>Have you ever tried to run a query
>
>delete from TableName T1
>where exists ( select * from TableName T2
> where T1.PKID=T2.PKID
> and T1.RDB$db_key<T2.RDB$db_key);
>
>when the table contains 4 million records?

If you have an index on PKID (not necessarily unique), I think it would
execute pretty quickly.

>So I am still thinking about which approach I should use to remove
>the double records.
>Posibilities:
>- Select distinct * for each table and export it as raw data and
>import it again
>- Copy the database using a custom made application which tries to
>insert each record and if it fails I do not mind.

I think the 'delete option' sounds most appealing.

>Does somebody know if it is possible to run queries accross multiple
>database for this use?

No, crossdatabase queries are only supported by the BDE, and that will kill
your performance completely!

HTH,
Set