Insert row into MS Access database table form SQL server table

Hi there,
I am trying to insert data into a MS access table from an SQL server table. Do i need to add this as a linked server or is there a query i can run? I am coming across many errors when i try to create a linked server and also if try to do a pass through query.

Can anyone demonstrate some code that works corectly for this task?

thanks
richard
crichAsked:
Who is Participating?
 
danblakeCommented:
You could create a DTS Package, using the Import/Export wizard -- to export to the Access table.

Ensure Access is installed on the destination machine (to ensure you will be able to update the Access database).
0
 
ChoppertooCommented:
A DTS package would be able to export SQL rows to an MS Access Table. Or you could work it the other way around and use MS Access to pull the records friom SQL server using OLEDB/ODBC
0
 
danblakeCommented:
Yes.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
arbertCommented:
You could also use a linked table in access or OPENDATASOURCE executed on SQL Server (without a linked server)

SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
  'Data Source="c:\yourdatabase.mdb";User ID=Admin;Password=;')



0
 
crichAuthor Commented:
I have already tried these pieces of code and thet are not suitable for various reasons. Any other ideas?
0
 
danblakeCommented:
I think you need to be more precise on what you are trying to achieve, and why these items of code are not suitable for us to provide you with a good answer that you are looking for.
0
 
ChoppertooCommented:
Ok questions?

Does the data have to be pushed from the SQL server to MS Access?

How are you identifying the record that is to be appended to MS Access?

If you have to push the data from SQL server to MS Access then there are two methods;

first is a linked server ... a good article on how to do this here;
http://www.databasejournal.com/features/mssql/article.php/3085211

The second way is via a DTS package .... using a sql statement to select the records you wish to append to MS access ... again an article on how to do this is here;
http://www.databasejournal.com/features/mssql/article.php/3089011

My own personal preference however, would be to pull the data from SQL server using MS Access as a client. Incorporating a boolean "sent_to_access" flag on a field in the SQL table would mean that a view could be constructed on SQL server showing records not yet sent to access, it would then be a simple matter of linking the SQL table to MS Access (from MS Access as an ODBC connection) creating an append query in MS Access to insert the records into a MS Access table and then running an update query to set the "sent_to_access" flag to true.
0
 
danblakeCommented:
Can anyone demonstrate some code that works corectly for this task?
We cannot unless we get a list of errors from your particular enviroment, there may be a specific fix that is missing for your enviroment.  It is better that we choose an approapriate technology/solution that will work given any necessary fixs.  
0
 
arbertCommented:
"I have already tried these pieces of code and thet are not suitable for various reasons."

I agree with the above comments.  We need to know why they are not suitable....I would also so NO REFUND of points as the above answers did assist with your original question.
0
 
ChoppertooCommented:
Agreed, though it appears that he is trying to create an access database as a linked server and says " I am coming across many errors " what are these errors?
A little bit more detail could help people solve your problem .... so I have to agree - no refund of points as the original question is so vague  and has not been expanded upon after requests from experts. How can anyone help if the problem itself hasn't been identified?
0
 
danblakeCommented:
How about points all round ?

We've given 3 different mechanisms from three different people !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.