SQL Notebook (logo)

EXPORT TXT Statement

Writes a text file (.TXT) to disk from a SELECT query. If the query has multiple columns, they are concatenated together with no separator. The text is not escaped or quoted.

Syntax

Syntax for the EXPORT TXT statement

Arguments

Options

Examples

  1. EXPORT TXT 'C:\MyFile.txt' FROM (SELECT * FROM mytable);
    Writes the contents of mytable into a file called "MyFile.txt". Because no options are specified, the lines are appended to "MyFie.txt" and the UTF-8 encoding is used.
  2. EXPORT TXT 'C:\MyFile.txt' FROM (SELECT * FROM mytable) OPTIONS (TRUNCATE_EXISTING_FILE: 1);
    Overwrite "MyFile.txt" if it already exists.