# Copy all records

**URL:** <https://forum.servoy.com/t/copy-all-records/5971>\
**Category:** Classic Servoy\
**Created:** [May 24, 2006, 7:16am UTC](https://forum.servoy.com/t/copy-all-records/5971 "2006-05-24T07:16:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodneysieb](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rodneysieb](https://forum.servoy.com/u/rodneysieb)\
**Post date:** [May 24, 2006, 7:16am UTC](https://forum.servoy.com/t/copy-all-records/5971/1 "2006-05-24T07:16:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [May 24, 2006, 12:16pm UTC](https://forum.servoy.com/t/copy-all-records/5971/2 "2006-05-24T12:16:26Z")

</div>

look at the databaseManager-node

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

Hope this helps

---

<div class="post-metadata">

**Author:** ![rodneysieb](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rodneysieb](https://forum.servoy.com/u/rodneysieb)\
**Post date:** [May 25, 2006, 1:21am UTC](https://forum.servoy.com/t/copy-all-records/5971/3 "2006-05-25T01:21:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rodneysieb](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rodneysieb](https://forum.servoy.com/u/rodneysieb)\
**Post date:** [May 25, 2006, 6:02am UTC](https://forum.servoy.com/t/copy-all-records/5971/4 "2006-05-25T06:02:31Z")

</div>

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`,`adcode`FROM ad\_web”);

forms.adlibrary\_list\_copy.controller.loadAllRecords();

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

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [May 25, 2006, 9:44am UTC](https://forum.servoy.com/t/copy-all-records/5971/5 "2006-05-25T09:44:42Z")

</div>

Cool! ![8)]( "Cool") nice tip!
