Using Openrowset to query csv and tsv files

The following will read a csv file. 

SELECT * FROM OPENROWSET (‘MSDASQL’, ‘Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=c:data;’, ‘SELECT * from test.csv’);

The following will read a tsv file (with a txt extension).

SELECT * FROM OPENROWSET (‘MSDASQL’, ‘Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=c:data;’, ‘SELECT * from test.txt’);

3 thoughts on “Using Openrowset to query csv and tsv files

  1. Have you tried this in an x64 environment? We’re having an environment freak out on this between a dev and production environment and trying to nail down what is causing it.

  2. Welcome to hell.

    x64 SQL does not include Jet and according to Microsoft never will. Jet is how this text driver works.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s