I'm looking to make use of data held within '.csv' files via SQL syntax.
However the fields held in these files can differ.
How can I obtain the list of column/field headers from a named 'csv' file via SQL syntax?
I'm currently using the following (for example) to return a result set - which has the column headers matching those as seen within the '.csv' file:
Any suggestions would be appreciated.
Thanks in advance.
However the fields held in these files can differ.
How can I obtain the list of column/field headers from a named 'csv' file via SQL syntax?
I'm currently using the following (for example) to return a result set - which has the column headers matching those as seen within the '.csv' file:
Code:
SELECT *
from OpenRowset('MSDASQL',
'Driver={Microsoft Text Driver (*.txt; *.csv)};
DefaultDir=C:\Test',
'select * from File1.csv')
Any suggestions would be appreciated.
Thanks in advance.