Export data from SQL Server to MS Access

No.of Views2316
Bookmarked0 times
Downloads 
Votes0
By  muhammadshahidfarooq   On  16 Feb 2010 00:02:17
Tag : Sql Servers , T-SQL
Export data from SQL Server to MS Access
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

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.

{codecitation class="brush: sql; gutter: true;" width="500px"}
INSERT INTO OPENROWSET

('Microsoft.Jet.OLEDB.4.0',

'C:\Test.mdb';'Admin';'',

'Select * From ‘AccessTableName’)

Select * From ‘SQLTableName’

{/codecitation}

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' }
)


History

Initial Version - November 26, 2008.

Reference

MSDN Library.

About the Author

Muhammad Shahid Farooq is a software engineer with having experience of 2+ years of working on C#, Java, SQL, VB.Net, VB 6 and other latest technologies. He holds Bachelor’s degree in Computer Science from the University of Central Punjab, Lahore, Pakistan.

 
Sign Up to vote for this article
 
About Author
 
muhammadshahidfarooq
Occupation-
Company-
Member Type-Fresh
Location-Pakistan
Joined date-29 Jun 2009
Home Page-
Blog Page-
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top