Copy all records

Hi All

I want to copy all records from all columns in table(ADweb) and paste them into an identical table(ADweb_copy). i’m aware there is a copyAllRecords function but not sure how i paste the data into the destination table?

look at the databaseManager-node

databaseManager.copyMatchingColumns(srcRecord,destRecord [,overwrite])

Hope this helps

Hi Harjo

Thanks for the help,

I have found the following SQL statement which should do want i want without creating arrays, loops etc:

plugins.rawSQL.executeSQL(‘server_name’, ‘table_name’, ‘INSERT INTO ad_folder_copy(*)SELECT * FROM ad_folder’);

but it does not execute and copy any records, is this the right code?

Hi

Played around again with the code works with the following:

//deletes the current records in the table
forms.adlibrary_list_copy.controller.deleteAllRecords();

//copies all records from table ad_web into ad_web_copy
plugins.rawSQL.executeSQL(‘aerotrack’, ‘ad_web’,“INSERT INTO ad_web_copy (adcode_id,adname,adcode)SELECT adcode_id,adname,adcodeFROM ad_web”);

forms.adlibrary_list_copy.controller.loadAllRecords();

Works extremely fast too, 12000 records in a split second, very impressive!

Cool! 8) nice tip!