Tuesday, November 17, 2015

access accdb import to sql server

1) split access to table
menu -> database tools -> access database, click split database, next...
you will get a file xxx_be.accdb
   

used Microsoft Office 15.0 Access Database Engine OLE DB Provider For the Source
and SQL Server Native Client 11.0 For the Destination

2)
error: 

Error 0xc02020e8: Source - Amounts [1]: Opening a rowset for "Amounts" failed. Check that the object exists in the database.

There is import wizard bug, when you select 'copy data from one or more table...', the automatic generated sql have single quote on table name, which cause error message, [Opening a rowset for "Amounts" failed. Check that the object exists in the database.] Click the 'preview' button(next to 'edit mapping' button), you can see the sql.
The solution is remove the single quote around table name by go back, choose 'write a query to specify the data to transfer'. now write your query. then next, then double click the [dbo].[query] change to the table name you want, [dbo][your_table_name]
you have to do one table by one table, i finally figure it out and make it works.

3) access column(date time) data value run out of range when conversion. These type of error  might be some bad value in some row cause failure to copy to destination table.  
the best way to do it is export each table to excel, then import excel to sql server. I test it with this way, no date time conversion error.

No comments: