Error when SQL-querying flatfiles with custom file-extension

大兔子大兔子 提交于 2020-01-03 19:05:57

问题


I'm looking for a way to query flatfiles with custom file-extensions directly via SQL.

Normally use something like

SELECT * FROM [Text;DATABASE=C:\Flatfiles].[S7121070_ppis#csv]

which works terrific with .txt, .csv and .tab.

However, in my current project I work with fixed-width flatfiles with an .ftp7-extension. When querying those files in with VBA, I encounter Err# -2147217911, stating that the object or database is locked.

Oddly, this occurs only whenever I querying anything that's not a .txt, .csv or .tab. Meaning myfile.ftp7, myfile.ftp, myfile.abc or myfile can't be queried.

Can't this be done or am I simply missing something? Thanks for your help! Cheers, Martin

Additional Info:

  • I use either Excel or Access with VBA
  • Renaming .ftp7 to .csv, .txt, .tab solves the problem, but is a no-no due to read-only access
  • I can use a schema.ini-files to describe the data-structure, so i would have expected that the actual file-extension is more or less redundant for interpreting the files contents

回答1:


As postet by Fionnuala: Editing the registry seems to solve the problem.



来源:https://stackoverflow.com/questions/40548303/error-when-sql-querying-flatfiles-with-custom-file-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!