Search code examples
c#access-data-project

Copy table in access database in another table with C#


I have created a C# project using MS Access Database and I want to copy data from one table in to another.Is there a simple way to copy all records from one table to another?


Solution

  • If the columns are in the right order, you can do

    insert into table2
    select * from table1
    

    If the order of the columns are different between the two tables, you can do

    insert into table2 (column1, column2, column3)
    select column1, column2, column3 from table1