用OPENROWSET如何从SQL2000复制表到Access2000里??
我用OPENROWSET从Access2000复制表到SQL2000里 :
SELECT * into [table] FROM OpenDataSource(Microsoft.Jet.OLEDB.4.0,Data Source= " ";Jet OLEDB:Database Password=)...[table]
那反过来 用OPENROWSET如何从SQL2000复制表到Access2000里??
------解决方案--------------------
Transact-SQL语句进行导入导出:
1. 在SQL SERVER里查询access数据:
-- ======================================================
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0 ',
'Data Source= "c:\DB.mdb ";User ID=Admin;Password= ')...表名
-------------------------------------------------------------
2. 将access导入SQL server
-- ======================================================
在SQL SERVER 里运行:
SELECT *
INTO newtable
FROM OPENDATASOURCE ( 'Microsoft.Jet.OLEDB.4.0 ',
'Data Source= "c:\DB.mdb ";User ID=Admin;Password= ' )...表名
-------------------------------------------------------------
3. 将SQL SERVER表里的数据插入到Access表中
-- ======================================================
在SQL SERVER 里运行:
insert into OpenDataSource( 'Microsoft.Jet.OLEDB.4.0 ',
'Data Source= " c:\DB.mdb ";User ID=Admin;Password= ')...表名
(列名1,列名2)
select 列名1,列名2 from sql表