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


Parameters

Options

Example

-- Writes the contents of mytable into a file called "MyFile.txt".
-- Because no options are specified, the lines are appended and
-- the UTF-8 encoding is used.
EXPORT TXT 'C:\MyFile.txt'
FROM (SELECT * FROM mytable);

-- Overwrites "MyFile.txt" if it already exists.
EXPORT TXT 'C:\MyFile.txt'
FROM (SELECT * FROM mytable)
OPTIONS (TRUNCATE_EXISTING_FILE: 1);