简体   繁体   English

如何在文本文件中导出 MS Access 表

[英]How to export MS Access table in text file

i am interested is it possible to create automated script to export single table from MS Access database in text file, and after that to have other script to automated import that text file in MySQL database, or maybe there is some better way to solve this kind of problem ?我感兴趣的是是否可以创建自动脚本以从文本文件中的 MS Access 数据库导出单个表,然后让其他脚本在 MySQL 数据库中自动导入该文本文件,或者可能有一些更好的方法来解决这种问题问题? Also, server where is MS Access is running on windows , and MySQL service is working on Linux distribution CentOS.此外,MS Access 所在的服务器在 Windows 上运行,MySQL 服务在 Linux 发行版 CentOS 上运行。 Thanks.谢谢。

You can use jet-tool to get SQL dump of .mdb file.您可以使用jet-tool获取.mdb文件的 SQL 转储。

jet dump -f Your.mdb >dump.sql

Then import dump.sql by means of MySQL.然后通过MySQL导入dump.sql

I guess these two databases don't talk, or you should be able to export from MS Access and send the job straight to MY SQL.我猜这两个数据库不会说话,或者您应该能够从 MS Access 导出并将作业直接发送到 MY SQL。 Is that right?是吗? Here is a script to do the export from Access to a text file.这是一个从 Access 导出到文本文件的脚本。

Public Sub ExportTable()
   DoCmd.OutputTo acOutputTable, "tblCustomer", acFormatTXT, _
   "C:\BegVBA\Customer.txt"
End Sub

I haven't used MY SQL in a couple of years at least, and I don't have it setup on my machine now.我至少有几年没有使用过 MY SQL,现在我的机器上也没有设置它。 Anyway, I think it would be something like this.无论如何,我认为它会是这样的。

LOAD DATA INFILE '/tmp/mydata.txt' INTO TABLE PerformanceReport;

If that doesn't do the trick, you can easily Google it and figure it out yourself.如果这不起作用,您可以轻松地在谷歌上搜索并自行解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM