Ghadir
Ghadir

Reputation: 47

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?

Upvotes: 2

Views: 1705

Answers (2)

Dextere
Dextere

Reputation: 301

How does this sound?

INSERT INTO Table2( Field1, Field2, FieldN )
SELECT Field1, Field2, FieldN
FROM Table1;

Upvotes: 1

Guilherme
Guilherme

Reputation: 5341

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

Upvotes: 3

Related Questions