问题
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