Subject Re: [IBO] update from one database to another
--- In IBObjects@y..., Svein Erling Tysvær
<svein.erling.tysvaer@k...> wrote:
Thanks Svein. the trouble is that I am lazy! I hate writing out all
those field names for a dsql update statement. I hoped a live cursor
with 'select * ' would do the trick.
I suppose I can work out set 'fields[jj] = values[jj]' for jj from 0
to fieldcount-1 somehow in a dsql ?

Oh of course, I did not mention, but I was trying to write a routine
to cover various tables so I don't know the field-names unless I
gather them into a string-list.

Back to the drawing board !
Thanks Dave.

> Hi Dave!
> This should be simple.
> >I have tried to open a query on the source table (to get a dataset
> >only the update-needing records). Then going down these records to
> >eof, at each source record have opened a cursor on destination
> >table , set it in edit mode, copied the fields across one-by-one,
> >then posted the dest table record.
> Your start is good, albeit if done without user interaction a
TIB_Cursor would be preferrable to a TIB_Query. But then you mess
things up. Use a TIB_DSQL for
> your destination table (use a tiCommitted transaction without
AutoCommit for it), assign an update statement to it (UPDATE <table>
SET <field> = <value>
> WHERE <pk> = <value>), prepare this DSQL, loop through all records
in source assigning the values to the parameters to your DSQL and
call Execute (or
> ExecSQL). When your finished with all your records (or maybe for
every x records if you're updating very many records) call Commit for
your transaction(s).
> HTH,
> Set