<来源网址:http://www.delphifans.com/infoview/Article_398.html>
异构数据库之间完全可以用SQL语句导数据
告诉你一个最快的方法,用SQLServer连接DBF
在SQLServer中执行
SELECT * into bmk
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="e:\share";User ID=Admin;Password=;Extended properties=dBase 5.0')...bmk
这样就可以把e:\share中的bmk.dbf表导入到Sqlserver中,速度是最快
在Form上放一个ADOConnection,连结指向目标Access库比如txt文件在c:\temp\aaaa.txt
就执行
ADOConnection.Connected := True;
ADOConnection.Execute('Select * Into abcd From [Text;Database=c:\temp].aaaa.txt');
txt导入SQLServer
select * from OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)};
DefaultDir=c:\temp;','select * from aaaa.txt')
把Excel导入到Access中,同txt类似
select * into <table name> from [excel 8.0;database=<filename>].[<sheetname>$]
Excel联接ADO串
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\a.xls;Extended
Properties="Excel 8.0;HDR=Yes;";Persist Security Info=False
Extended Properties参数属性这样写 Excel 5.0;HDR=YES;IMEX=1
IMEX=1就是指混合型转换为文本
SQLServer从Excel取数
SELECT *
FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source="C:\temp\b.xls";Extended Properties="Excel 5.0;HDR=Yes;";Persist Security Info=False')...sheet1$
c:\temp\aaa.dbf to Access,
ADOConnection 指向Access
语句是 select * into bbb from aaa in 'c:\temp' 'dbase 5.0;'
sql server导出到access
ADOConnection 指向Access
SELECT * into table FROM Tab1 IN [ODBC]
[ODBC;Driver=SQL Server;UID=sa;PWD=;Server=127.0.0.1;DataBase=Demo;]
如何把SQL Server的表导出到Access、Text、Dbf。
当然可以在程序中运行SQL Server表导出和txt导入一个道理基本上都是用Jet4.0 和 ODBC连结实现
先用用Jet4.0连结dbf,access,txt然后利用SQL语句导出导入在此我就不详细说了,一句话,都可以的
列出连结串属性Extended properties,
DBase 5.0
DBASE IV
FoxPro 3.0
Paradox 7.X
Excel 8.0
text;HDR=YES;FMT=Delimited
SELECT * into aaa
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\temp\";User ID=Admin;Password=;Extended properties=Text')...[bb#txt]
(出处:www.delphibbs.com)