EXPORT

Core command EXP EXTRACT EXT

Turns export mode ON or OFF and, if ON, specifies the target file name. Supported formats: text files, CSV, MS Excel (XLSX), OpenDocument Spreadsheet (ODS), MS Access(MDB)

Arguments

<fileName> (optional) if empty, turns export off. Without directory information, files are exported to folder specified in parameter DefaultFolder, section [General] of INI file BroadSQL.ini. If fileName has no extension, one is appended based on parameter DefaultFileFormat (XLSX, ODS, CSV or TXT; defaults to ODS).

Examples

EXPORT output;
EXPORT c:\temp\output.xlsx;
EXP;

Notes

Turns export mode on or off for the current session: EXPORT [<fileName>].

With no argument, turns export mode off (subsequent output goes back to the screen). With a file name, turns export mode on: every SQL statement run afterwards writes its result to that file instead of the screen, until EXPORT is called again with no argument (or a new file name). Unlike DUMP, which extracts one table in a single step, EXPORT only changes where subsequent output goes.

If fileName has no extension, one is appended based on DefaultFileFormat in BroadSQL.ini (.xlsx, .ods, .csv or .txt - defaults to .ods if that parameter is absent or invalid). If it has no directory part, it is written to the configured export folder (DefaultFolder in BroadSQL.ini); if it does include a directory, that directory must already exist, or the command fails. The file extension determines the output format: plain text, comma-separated (CSV, RFC 4180 quoting), Excel (.xlsx), OpenDocument Spreadsheet (.ods), or MS Access (.mdb). The legacy binary Excel format (.xls) is not supported - use .xlsx instead.

Recommended alternative for a one-shot query/table export: `PULL <source> TO <name> AS CSV/TXT (see CommandPull`, docs/PULL_TO_TEXT.md) is the modernized, unified replacement for this command's CSV/TXT output - same command family as PULL ... AS H2/XLSX/ODS. Not a drop-in replacement for every existing script, though: unlike this command's CSV output (always comma) and TXT output (whatever SET SEP currently holds), PULL ... AS CSV uses the separate CsvSeparator INI setting (semicolon if absent) and AS TXT always uses a tab - neither honors SET SEP - and PULL rejects BLOB/CLOB/binary columns outright rather than writing whatever ResultSet.getString() returns for them. This command is unaffected by that addition and keeps working exactly as documented above.

Last modified in release 5.0.7.