SQL copy record
Posted on 2001-07-04
I'm not that familar with databases so this question may be impossible to solve or sound stupid to you, but I hope you understand it :)
I have selected a record in a TQuery and wants to insert this record into another table in another database.
The function should be generic and handle all kinds of datatypes: VarChar, Timestamp, Blob etc.
I was told not to use BDE if it's possible, that means I can't use TBatchMove, isn't that correct?
The way I thought of is to have two TQueries, One to select the record another on to do the insertion, with this SQL code:
INSERT INTO :TABLE VALUES(:VALUES)
I would then fill out the params, but how does I fill out VALUES. When I can get a lot of different types it isn't just to loop through, like this (may have errors, but you should get my point)
for i:=0 to Query1.FieldCount-1 do
Values := Values+'"'+Query1.Fields[i]+'";'
What to do?