OPENROWSET load data from CSV file

Alan5896 26 Reputation points
2023-05-12T01:00:24.5333333+00:00

In SQL Server 2008 this worked fine, but does not work on 2014. Please help load data same way from csv

 
           SELECT *  --- worked on ol
      
           FROM OPENROWSET
('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=C:\Users\ekokota\Desktop\SF\;',
 'SELECT * from RecordTypes.csv');
SQL Server Other
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-05-12T02:01:23.38+00:00

    Hi @Alan5896

    2014 version seems to be an old version. The Official documentation about OPENROWSET could not be found for the 2014 version. You can try the usage in the 2016 version.

    https://learn.microsoft.com/en-us/sql/t-sql/functions/openrowset-transact-sql?view=sql-server-2016

    User's image

    Best regards,

    Percy Tang


    If the answer is the right solution, please click "Accept Answer". If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Olaf Helper 47,436 Reputation points
    2023-05-12T04:33:12.0933333+00:00

    but does not work on 2014.

    "Not work" means waht in details? Do you get an error message and if,which one?

    DBQ=C:\Users\ekokota\Desktop\SF\

    You locate the file in a user profile folder, where only the user "ekokota" do have access for, but not the SQL Server service account. Move the file to folder, where SQL Server have at least read permissions for.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.