[英]How to schedule data insertion from dbf to SQL Server on 64-bit Windows Server 2012
I am working on a Windows Server 2012 64-bit. 我正在使用Windows Server 2012 64位。 I want to be able to import data from a .dbf
file into a SQL Server table. 我希望能够将数据从.dbf
文件导入到SQL Server表中。 I used the import wizard and it worked correctly. 我使用了导入向导,它可以正常工作。 However, I have SQL Server Express and can't schedule this insertion. 但是,我有SQL Server Express,并且无法安排此插入。
Is there another way to schedule the insertion of the .dbf
data to the SQL Server tables, without the use of the SSIS package loader? 是否有另一种方法可以安排在不使用SSIS包加载器的情况下将.dbf
数据插入SQL Server表中?
Update 更新资料
I ended up using Python and writing a script to import from XML. 我最终使用Python并编写了一个从XML导入的脚本。 However, I believe the answer by @Oleg was the most accurate, given the circumstances. 但是,在这种情况下,我认为@Oleg的回答是最准确的。
Thank you all! 谢谢你们!
I suggest you the next approach: 我建议您使用下一种方法:
OleDbConnection
(to fetch) and SqlConnection
(to upload) objects to import data from the .DBF
file to SQL Server database table. 创建C#脚本,该脚本将使用OleDbConnection
(以获取)和SqlConnection
(以上传)对象将数据从.DBF
文件导入SQL Server数据库表。 LinqPad
, LinqPad command-line utility ( lprun.exe
) and windows Scheduled Task
service automate the execution of the mentioned script file 通过使用LinqPad
,LinqPad命令行实用程序( lprun.exe
)和Windows Scheduled Task
服务,可以自动执行上述脚本文件 Useful links: 有用的链接:
How to get data from DBF file using C# 如何使用C#从DBF文件获取数据
How to load data into datadase using C# 如何使用C#将数据加载到datadase中
Another way is create a SQL linked server an ODBC that is pointing at the DBF. 另一种方法是创建一个SQL链接服务器和一个指向DBF的ODBC。 Use Windows scheduler to call SQLCMD.EXE to run some SQL to copy the data in. 使用Windows调度程序调用SQLCMD.EXE来运行一些SQL复制数据。
You can also use DBF Commander Pro for this task: 您也可以使用DBF Commander Pro来完成此任务:
Create command line for your insertion - choose 'File -> Export to DBMS'. 为插入创建命令行-选择“文件->导出到DBMS”。 Specify transfer options in the window appears, then copy the command line from the bottom of the window: 在窗口中显示“指定传输选项”,然后从窗口底部复制命令行:
Create text .BAT file and insert the copied command line, eg: 创建文本.BAT文件并插入复制的命令行,例如:
"c:\\Program Files\\DBFCommander\\DBFCommander.exe" -edb "D:\\Data\\customer.dbf" customer_table "Provider=SQLOLEDB.1;User ID=user1;Initial Catalog=test_db;Data Source=test_server" “ c:\\ Program Files \\ DBFCommander \\ DBFCommander.exe” -edb“ D:\\ Data \\ customer.dbf” customer_table“ Provider = SQLOLEDB.1;用户ID = user1;初始目录= test_db;数据源= test_server”
Make a schedule using Windows Scheduler that will execute this .BAT file. 使用Windows Scheduler计划将执行此.BAT文件的计划。
Additional info that may be useful for you: 可能对您有用的其他信息:
Using DBF in batch mode 在批处理模式下使用DBF
Export DBF file to SQL database 将DBF文件导出到SQL数据库
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.