With a “CSV Text connection” you can list, view and analyse your text files like SQL tables.

Via Menu “File” -> “Create CSV Text connection” you can create this connection type in Server Manager and query the CSV Files like a simple tables.

This is done with the CsvDriver. The SQL Syntax is limited by the driver and is executed localy. You can’t use the Caché SQL Syntax cause it is not Caché you’re using.

Some short details:

  • CsvJdbc accepts all types of CSV files defined by RFC 4180.
  • CsvJdbc accepts only SQL SELECT queries from a single table and does not support INSERT, UPDATE, DELETE or CREATE statements.
  • SQL sub-queries are permitted but joins between tables in SQL SELECT queries are not yet supported.
  • SQL SELECT queries must be of the following format
SELECT [DISTINCT] [table-alias.]column [[AS] alias], ...
 FROM table [[AS] table-alias]
 WHERE [NOT] condition [AND | OR condition] ...
 GROUP BY column ... [HAVING condition ...]
 ORDER BY column [ASC | DESC] ...

Using zip files

You can pick up a ZIP file that contains multible csv text files.

Please see the next Screenshot for details. The CSV Connection is created to the file “IDS_CSV.zip”. That that coctain multible files one of them ist called “IDS_DATA.csv”. By opening a query editor and writing the query “SELECT * FROM IDS_Data” you can view and analyse this text file:

Using folder with many csv files without importing data

You can just select a Folder for a CSV Connection and automatically query all *.csv files within this folder via SQL. Please see the next Screenshot for details. The CSV Connection is created for a folder called “testdata” within this folder exists a file called “population.csv”. Just write “select * from population LIMIT 100” to get the first 100 rows of this file.