如何加快 csv 和访问速度
txt 文件中有超过 210,000 条记录。一条记录具有三列,并以空格分隔。要将此文件导入到 ms access,系统会将空格替换为逗号。然后使用insert into,系统一次性全部导入。系统需要对这些记录进行排序和搜索。整个处理时间非常慢。需要 15 分钟以上。 如何提速?
- 是否能够处理ms access的表中超过21万条记录 2003年?
- 不替换逗号,我们能否将这个txt文件导入到access中呢?
谢谢。
There are over 210,000 records in a txt file. One record has three columns with space split. To import this file into ms access, system replace spaces into comma. And then using insert into, system imports all at once. System needs to sort and search with these records. The whole processing time is so slow. It takes over 15 minutes. How to speed up?
- Is it able to handle over 210,000 records in a table of ms access
2003? - Without replacing comma, could we import this txt file into access?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Access 可以导入使用空格而不是逗号作为分隔符的文本文件。在 Access 2003“导入文本向导”的第一页上,选择“分隔 - 逗号或制表符等字符分隔每个字段”旁边的单选按钮。单击“下一步”,然后在下一个向导页面上,选择“选择分隔字段的分隔符”标题下“空格”旁边的单选按钮。
您可以通过单击“高级...”按钮打开“导入规范”对话框,然后单击右侧的“另存为...”按钮,将导入选择保存为“导入规范”。在“保存导入/导出规范”对话框中指定规范名称,然后单击“确定”。
如果要使用代码执行此类导入操作,可以使用 TransferText 方法:
有关 TransferText 方法的更多详细信息,请参阅 Access 的帮助主题。
我注意到你的问题包含一个 vb6 标签,但不知道它是如何适应的。在我看来,使用 VBA 中的 TransferText 导入 210K 行 3 列的文本文件应该不会花费近 15 分钟。
Access can import a text file which uses spaces instead of commas as the delimiter. On the first page of the Access 2003 "Import Text Wizard", choose the radio button next to "Delimited - Characters such as comma or tab separate each field". Click "Next", and on the next wizard page, select the radio button next to "Space" under the "Choose the delimiter that separates your fields" heading.
You can save your import choices as an "Import Specification" by click the "Advanced..." button to bring up the Import Specification dialog, then clicking the "Save As..." button on the right. Assign a Specification Name in the "Save Import/Export Specification" dialog and click OK.
If you want to do this type of import operation with code, you can use the TransferText method:
See Access' help topic for more details about the TransferText method.
I noticed your question includes a vb6 tag, but don't know how that fits in. Seems to me that using TransferText from VBA to import a text file of 210K rows of 3 columns should not take anywhere near 15 minutes.