Click here to Skip to main content

Export data from SQL Server to MS Access

The purpose of this article is to provide a fast but easy way to export data from SQL Server to MS Access.
Sign Up to vote bad good
Add a reason or comment to your vote: x
Votes of 3 or less require a comment
See more: SQL-ServerAccess

Introduction

Exporting data from SQL Server to MS Access can be achieved in a variety of ways. The purpose of this article is to provide a fast but easy way to export data from SQL Server to Access.

Background

 

You must know how the select & insert statements work in SQL Server.

 

Using the Script

 

Create an access file named ‘Test’ on C:\ drive having the table and their columns same as that of SQL and use this script.

 

The script below is amazingly simple to use.

 
INSERT INTO OPENROWSET 
 
('Microsoft.Jet.OLEDB.4.0', 
 
'C:\Test.mdb';'Admin';'', 
 
'Select * From ‘AccessTableName’) 
 
Select * From ‘SQLTableName’
 

The OPENROWSET function in SQL Server provides a way to open an OLE DB compatible data source (i.e. MS Access in our case) directly from your SQL script.

 

Syntax

 
OPENROWSET ( 'provider_name' 
, { 'datasource' ; 'user_id' ; 'password' 
| 'provider_string' } 
, { [ catalog. ] [ schema. ] object 
| 'query' } 
) 
 

Reference

 

MSDN Library.

Posted 17 Nov '09
Edited 18 Oct '11


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

Your Filters
Interested
Ignored
     
  1. Wonde Tadesse (1,110)
  2. SAKryukov (600)
  3. CRDave1988 (367)
  1. SAKryukov (10,082)
  2. Christian Graus (6,019)
  3. OriginalGriff (4,866)
  4. Abhinav S (4,500)
  5. thatraja (4,349)

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questionerror PinmemberMustafa Magdy11:38 25 Sep '11  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.5.120210.1 | Last Updated 18 Oct 2011
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid