I am building a C# project that transfers data from an Access database to an SQL database. I am using this command:
sqlMergeDB = "Insert int work.sql_merged_database.dbo." + tablename[a] +
"SELECT * FROM acs_merged_database.mdb." + tablename[a];
It keeps saying it doesn't recognize the Access table object and I am a thousand percent sure the table name is correct and there is a connection to the database. Maybe I don't know a certain syntax for listing Access data objects.
More specifically the error is invalid object name.
Ben,
you should create a Linked Server in your SQL server to contact the Access db, for this step you can check this: SQL to Access linked server
Then you can run your insert statement as:
INSERT INTO work.sql_merged_database.dbo.TableA (ColumnA, ColumnB) SELECT ColumnA, ColumnB FROM LinkedServerName.acs_merged_database.SchemaName.TableName
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.