Subject Re: [ib-support] Delphi Delete Records
Author Helen Borrie
At 10:06 AM 04-11-02 +0100, you wrote:
>In message <NBBBJKLIEJPCMJJOFDNPMENAEIAA.alan@...>, Alan
>McDonald <alan@...> writes
> >you need stored procedures
> >i doubt it's too complicated for stored procedures
>
>trust me, it is... there are a lot of conditions, and the Delphi
>component written to check them is B I G.

As a Delphi programmer, I can imagine the B L O A T you have had to put
into a data-tidying component to make it do a task which would be
economical and, by comparison, simple to do on the server in one or a suite
of stored procedures.

>The procedure is a 'file tidy' which deletes certain records under
>certain, changing, conditions.

Sounds like a job for Mr Trigger.

create trigger AU_TABLE_B for TableB
active after update position 0
as
begin
if (new.SomeFieldofTableB = 'Bomb it!') then
delete from TableA where <some relationship with an old or new field
in TableB>
end


>I don't have a problem with the time taken, it runs overnight, but I
>still can't figure out how to delete single records from the file which
>do not meet the criteria.

You don't mean "file", do you?

DELETE FROM aTable
where not (set of conditions)

heLen