Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

Custom File Extension for Microsoft Access Text Driver (*.txt, *.csv)

$
0
0

I'm trying to use a custom file extension for the Microsoft Access Text Driver (*.txt, *.csv) driver.

I have updated the FileExtns registry to have my new extension.

When I issue the following it does not work.

select[NoName] fromopenrowset('MSDASQL'
          
,'Driver={Microsoft Access Text Driver (*.txt, *.csv)};
                DefaultDir=c:\filedir'

          
,'select * from "file.lst"')

If I make the file a .csv it works fine.  However, if it has an extension of not CSV or TXT (in this case .lst, which is in the registry setting) extension it throws the following error and cannot seem to find a solution to it. 

OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Text Driver] Cannot update. Database or object is read-only.". Msg 7350, Level 16, State 2, Line 1 Cannot get the column information from OLE DB provider "MSDASQL" for linked server "(null)".

In addition, (although I can probably find this elsewhere), I need to have the first line 'BLANK' so that it does not miss data (there is no header row).  Is there  a way to use OPENROWSET without BULK to basically include all rows as data?

Any help is appreciated.


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>