Friday, March 23, 2012

Opendatasource problem

hi to every one...

To delete records in tableA which is not found in tableB i am using the following :
DELETE tableA from tableA aa left join tableB bb on aa.fld = bb.fld where bb.fld is null
** This will work fine **
but if i Use similer but using OPENDATASOURCE , like this:

delete OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\temp\data2004.mdb";
User ID="Admin";Password="";Jet OLEDB:Database Password="lea"')...tableA
from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\temp\data2004.mdb";
User ID="Admin";Password="";Jet OLEDB:Database Password="lea"')...tableA aa left join tableB bb on aa.lno=ba.lno where b.lno is null

the result is deleteing whole of TableA....

any help is appriciated
Thanks.Does this syntax work?:

delete
from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\temp\data2004.mdb";
User ID="Admin";Password="";Jet OLEDBatabase Password="lea"')...tableA aa left join tableB bb on aa.lno=ba.lno where b.lno is null|||this will not work , it will give the following error:

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near 'aa'.

No comments:

Post a Comment