Search code examples
sqlcsvoledbjet

What is the SQL dialect used to query CSV files through the OleDB Jet driver?


I am trying to execute a query against a CSV file using OleDbConnection, OleDbCommand and the Microsoft.Jet.OLEDB.4.0 driver but keep getting an exception saying no value given for one or more required parameters. I suspect the problem is in the SQL query syntax (I am trying to use the same queries I use with SQL Server) but I can find no manual to check it (another thing I would like to know is how exactly to address the columns if there is no header in the CSV file). Do you happen to know where is the SQL dialect I need described?


Solution

  • Jet 4.0 uses a dialect based on ANSI SQL 92. Source: http://support.microsoft.com/kb/275561/en

    Regarding the exception, your wondering of how to address columns is probably related, particularly if you have a WHERE clause checking a value in a column. If there is no header row, and the connection string has "HDR=NO" in the Extended Properties, you need to refer to the columns as F1, F2, F3, and so on in order from left to right. Source: http://support.microsoft.com/kb/316934