Re: How to use ADO Seek Method With Multiple Columns
- From: "Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom>
- Date: Wed, 14 Jun 2006 18:57:09 +0100
Thank you for responding. To clarify, I'm updating fields in Table A witha
PK from Table B. The new value for the A.<Field> depends on the matchingrow
in Table B. I don't know the value beforehand.
Well that is a complex SQL UPDATE.
But in all honesty, issuing a complex UPDATE is faster than coding a
solution where you do intermediate bits yourself
In general : let the database do the work. If it can be done with SQL then
do so. There wil lbe less programming errors as well.
UPDATE table1 SET field1 = t2.field2
FROM table1 t1 JOIN table2 t2 ON t1.field3=t2.field4
WHERE t1.field1 <> t2.field2
In this case field1 in table1 is updated to field2 from table2 on the basis
of the JOIN on other fields between the tables.
That ON clause will usually be some PK match fields
And I have reduced the work slightly by excluding all the entries which are
identical in the WHERE clause.
Any other redunant row reducing measures should be added to WHERE clause to
get a fast update.
All this can be done by via a ADO Connection Execute.
Stephen Howe
.
- References:
- Re: How to use ADO Seek Method With Multiple Columns
- From: Daniel Crichton
- Re: How to use ADO Seek Method With Multiple Columns
- From: Stephen Howe
- Re: How to use ADO Seek Method With Multiple Columns
- Prev by Date: RE: String as output from SP in C++
- Next by Date: RE: Query Excel 3.0 work***... not workbook
- Previous by thread: Re: How to use ADO Seek Method With Multiple Columns
- Next by thread: String as output from SP in C++
- Index(es):