Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello,

I have an access DB table, let me say it's in this form

Column 1 ---- Column 2 ---- Column 3 ---- column 4

and I want to insert data from this table to table at SQL Server DB

but SQL Server table has a different schema

like this for example


Column 1 ---- Column 3 ---- Column 5 ---- column 4 ---- Column 2 ---- Column 6

is there a way to copy data from the first access table to the second SQL table using ASP.Net, C# ?


thanks in advance : )
Posted

Assuming you know the values you want to insert at Column 5 and Column 6, all you have to do is name the columns when you insert the data: that way the order of the columns is irrelevant, SQL will sort out which value goes where:
SQL
INSERT INTO MyTable (column1, column2, column3, ...) VALUES ('C1', 'C2', 'C3', 'C4'...)
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900