现在的位置: 首页 > 综合 > 正文

sql server中查询access数据

2012年09月18日 ⁄ 综合 ⁄ 共 398字 ⁄ 字号 评论关闭
1 建立连接
sp_addlinkedserver 'linkedserver''Access'
'Microsoft.Jet.OLEDB.4.0',
'C:\access.mdb'

2 查询

SELECT *  into newtable 
FROM OPENQUERY(linkedserver, 'SELECT * FROM table'); 

注:
使用 sp_addlinkedserver 与 OpenQuery会避免一部分错误的发生
另外

sp_configure 'show advanced options'1;
GO
RECONFIGURE;
GO
sp_configure 
'Ole Automation Procedures'1;
GO
RECONFIGURE;
GO
sp_configure 
'Ad Hoc Distributed Queries' ,1
RECONFIGURE;
GO

应该会对你有用。

抱歉!评论已关闭.