Happy Day.

Try to queries:

Qry1:
SELECT Palletexport.Barcode FROM "PalletExport.DBF" Palletexport
    WHERE  Palletexport.ACK_MESS = '00-OK'

Qry2:
DELETE  FROM ":OneWorld:testdta.F59JL02" F59JL02
WHERE F59JL02.UDBAR = :value

Open Qry1 and traverse through all records.  On each record, pass the 
barcode field as a parameter to Qry2 and execute Qry2.

while not Qry1.EOF do
begin
  Qry2.ParamByName('value').AsString = 
Qry1.FieldByName('BarCode').AsString;
  Qry2.ExecSQL;
  Qry1.Next;
end;

You might not want to go through this hassle, but I know it will work 
because you know that the individual SQL statements work. I haven't dealt 
with single queries that access multiple databases before.

Cheers.
                        BJ...

----------
From:   Maurice Butler[SMTP:[EMAIL PROTECTED]]
Reply To:       [EMAIL PROTECTED]
Sent:   Wednesday, 02 December, 1998 14:58
To:     Multiple recipients of list delphi
Subject:        [DUG]:  Help with SQL and ODBC

Hi,
I have a heterogenous SQL Queries that deletes data off the server if it
exists in a local table. It always brings up an AVat xx in IDOBC32.dll at
write address XX after it has deleted the first record of a set.

the query is
DELETE  FROM ":OneWorld:testdta.F59JL02" F59JL02
WHERE F59JL02.UDBAR IN (SELECT Palletexport.Barcode FROM "PalletExport.DBF"
Palletexport
    WHERE  Palletexport.ACK_MESS = '00-OK')

 I have tested the delete as
DELETE  FROM ":OneWorld:testdta.F59JL02" F59JL02
WHERE F59JL02.UDBAR = value
 and it works fine

I have tested the select as
SELECT Palletexport.Barcode FROM "PalletExport.DBF" Palletexport
    WHERE  Palletexport.ACK_MESS = '00-OK'
and it works fine.

":OneWorld:testdta.F59JL02"  is on the MS SQL server
and "PalletExport.DBF" is the local table.
------------------------------------------------------------------------  
----
----
Maurice Butler     Like Magic Ltd    (025) 273 9248


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to