Solved

Bulk Import Access Table to SQL Server

Posted on 2014-01-08
4
1,549 Views
Last Modified: 2014-01-26
Hi,

What's the best to bulk import an Access table into SQL Server 2012?

I tried using this

SELECT * INTO [E2].[dbo].[Test]
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','C:\TEST.ACCDB';;, 'SELECT * FROM [Test]')

and it runs extremely slow.

Thanks.
0
Comment
Question by:akivashapiro
  • 3
4 Comments
 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39766276
Are you doing this as a one-off exercise or are you trying to do this as part of an application?

Assuming Access 2003, If you are doing it as a one-off then try this:

     Open the table

     File (Menu) --> Export

     Save as Type 'Text Files'

Don't use the 'save formated' option

That will bring up the Export Text Wizard

     Choose Delimited, click next

     Choose 'Comma' delimiter and " as Text qualifier.

     Choose 'Include Field names on First Row' if you want column headings

     Click next

     Give it a name and click finish

That will give you a CSV file.

If you want to do it as part of the application take a look at docmd.TransferText in MS Access help.

once you do the above steps and get the CSV file out,
Then you can either bulk insert or BCP commands to load them into your table pretty fast.
0
 

Author Comment

by:akivashapiro
ID: 39766355
I'm doing this as part of an application, but I'd much rather use a Transact-SQL statement to import the data directly from the Access table into a SQL Table. Please advise. Thanks.
0
 

Accepted Solution

by:
akivashapiro earned 0 total points
ID: 39798759
I solved this by Exporting the access table to a tab delimited text file and importing into SQLServer using Bulk Insert:


BULK INSERT dbo.tbl FROM 'TEMP.txt' WITH (FIELDTERMINATOR = '\t',ROWTERMINATOR = '\n')
0
 

Author Closing Comment

by:akivashapiro
ID: 39809850
It was the only option I could find. I worked very quickly - over a million rows export and import in less than a minute. But, you have to deal with data anomalies, such as hidden characters, prior to exporting to text.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now