user793468
user793468

Reputation: 4966

Populating Existing SQL Server Database tables with Access Database tables

I have an empty Table in SQL Server 2008 Database, I want to brink in data from a table in access Database to the SQL Server one. There are 1000's of rows that needs to be brought in. The issue is that There are additional columns in the SQL Server database table which are no present in Access database table.

Here I am mentioning one table, but there are about 15 tables that need to be updated from access db tables. What is the best bay of doing this?

Thanks in advance

Upvotes: 1

Views: 1724

Answers (1)

HansUp
HansUp

Reputation: 97101

In your Access db, you can create ODBC links to your SQL Server tables. Then execute what Access calls an append query for each pair (Access and SQL Server) of tables.

INSERT INTO remote_table1 (field1, field2, field3, etc)
SELECT field1, field2, field3, etc
FROM access_table1;

If the field names match and the data types are compatible, this should be fairly simple. It will take more work if your SQL Server fields have different names than their Access counterparts. And if the data types aren't directly compatible, you may be able to convert values with field expressions in the query. There are many data type conversion functions you can use in your Access query: CDate(); CStr(); CInt(); CLng(); etc.

Upvotes: 1

Related Questions