日期:2014-05-18 浏览次数:20524 次
exec sp_addlinkedserver 'sample','','Microsoft.Jet.OLEDB.4.0','d:\db1.mdb','','','db1' go insert into tb select * from sample...tb a where not exists(select 1 from tb where id=a.id) go exec sp_dropserver 'sample','droplogins'
------解决方案--------------------
Transact-SQL语句进行导入导出: 1.在SQL SERVER里查询access数据: -- ====================================================== SELECT * FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\DB.mdb";User ID=Admin;Password=')...表名 select * from opendatasource('Microsoft.Jet.OLEDB.4.0','Data Source="D:\db.mdb";User ID=Admin;Password=')...Student where name = '我' select * from newTable ------------------------------------------------------------- 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表 实例: insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'C:\db.mdb';'admin';'', Test) select id,name from Test INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\trade.mdb'; 'admin'; '', 表名) SELECT * FROM sqltablename insert into OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source="D:\db.mdb";User ID=Admin;Password=')...Student(studentid,name) select staffid,name from staff insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'D:\db.mdb';'admin';'', Student) select accountid,name from tblbaccount select * from openrowset('Microsoft.Jet.OLEDB.4.0','D:\db.mdb';'admin';'',Student) -------------------------------------------------------------
------解决方案--------------------
可不可以这样考虑:
系统在增加、修改或删除时同时对SQL与ACCESS作同步处理