需要将查询导出到管道分隔的.txt文件,并保存排序 [英] Need to export a query to a pipe delimited .txt file, with saved sorts

查看:53
本文介绍了需要将查询导出到管道分隔的.txt文件,并保存排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Access中的查询导出到带有已保存排序的竖线分隔的.txt文件,但保存的规范不会保留 排序。 有没有办法保存此导出规范以包含排序?

解决方案

您可以尝试更改排序依据属性桌子。您可以通过将表格切换到"设计视图"(如果未显示"属性表",请按F4),然后在"订购依据"属性中输入要排序的列,
,然后保存表格来执行此操作。 / p>

否则,另一种方法是使用SQL(带ORDER BY)&schema.ini文件:

 SELECT * INTO [Text; DATABASE = C:\ Users \ ... \Documents\My Database\Text; HDR = Yes]。[AccessTable.txt] FROM AccessTable ORDER BY [COL1] 

schema.ini文件的内容(位于目标文件夹中):


[AccessTable.txt]

ColNameHeader = True

CharacterSet = ANSI

格式=分隔(|)


 


I'm trying to export a query in Access to a pipe delimited .txt file, with saved sorts, but the saved specification does not keep the sorts.  Is there a way to save this export specification to include the sorts?

解决方案

You could try changing the Order By property for the table. You can do this by switching the table to Design View (press F4 if the Property Sheet is not displayed) and then enter the column you want to sort by in the Order By property, and then save the table.

Otherwise, another method would be to use SQL (with ORDER BY) and a schema.ini file:

SELECT * INTO [Text;DATABASE=C:\Users\...\Documents\My Database\Text;HDR=Yes].[AccessTable.txt] FROM AccessTable ORDER BY [COL1]

Contents of schema.ini file (located in target folder):

[AccessTable.txt]
ColNameHeader=True
CharacterSet=ANSI
Format=Delimited(|)

 


这篇关于需要将查询导出到管道分隔的.txt文件,并保存排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆