使用SQL Server上的存储过程更新访问表 [英] Update an Access Table Using a Stored Procedure on SQL Server

查看:122
本文介绍了使用SQL Server上的存储过程更新访问表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要连接到SQL Server上的Access表,以便我可以每天安排对Access表的更新。我如何连接Access表?我已经看到了如何将Access表连接到SQL表的东西,但没有什么只是从SQL Server更新Access表上的字段。



这是我在想的是调用的正确语法;

I need to connect to an Access table on SQL Server so that I can schedule an update to the Access table on a daily basis. How would I connect the Access table? I've seen stuff on how to connect an Access table to a SQL table, but nothing that just updates a field on an Access table from SQL Server.

This is what I am thinking is the correct syntax for the call;

UPDATE OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Location of .mdb';'admin';'password', NameOfTable)
 SET STATUS='REVOKED', APPR_DATE=REVO_DT
 WHERE REVOKE_DT <= @DT AND MEDIA_STATUS='PENDREVO'



但是给了我; OLE DB提供程序Microsoft.Jet.OLEDB.4.0尚未注册。

我不确定我是否正确这样做。有什么帮助吗?


But then is gives me; The OLE DB provider "Microsoft.Jet.OLEDB.4.0" has not been registered.
I'm not sure I'm doing this right. Any help?

推荐答案

是的,你是以正确的方式做的,但是......

如果在Windows上安装了SQL Server 64位,您需要安装并使用 ACE.OLEDB.xxx数据库引擎可再发行的 [ ^ ]。请阅读:访问x64计算机上的Excel文件 [ ^ ]。



回复OP的评论...

通过MS SQL服务器更新MS Access数据库的最佳方法是使用 sp_addlinkedserver 命令连接它:用于Jet的OLE DB提供程序 [ ^ ]
Yeah, you're doing it in proper way, but...
If SQL Server is installed on Windows 64 bit, you need to install and use ACE.OLEDB.xxx database engine redistributable[^]. Please, read this: Accessing Excel files on a x64 machine[^].

In reply to OP's comments...
The best way to update MS Access database via MS SQL server is to connect it using sp_addlinkedserver command: OLE DB Provider for Jet[^]


这篇关于使用SQL Server上的存储过程更新访问表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆