SQL Scripts 1.3 - Johan Compagner and Gerd Wagner

This plugin provides a wide range of scripting functions:

- You may create DDL scripts for tables out of the Object tree or from the Graph plugin. The scripts contain all constraints and indexes.

- You may create Insert scripts out of the Object tree for all of a table's data.

- You may create an insert script from an SQL Select statement. To do so in the SQL editor hit the `ctrl + t` shortcut to open the tools popup. Then choose the sql2ins function from the popup.

- You may export the result of an SQL Select statement directly into a file. To do so in the SQL editor hit the `ctrl + t` shortcut to open the tools pop-up. Then choose the sql2file function from the pop-up. Alternative, you can do this via the menu entry Session => Scripts => Store result of SQL in file

- You may store the result of an from an SQL Select statement in a temporary table. To do so in the SQL editor hit the `ctrl + t` shortcut to open the tools popup. Then choose the sql2table function from the popup.

- You may export the result of the currently selected SQL Select statement directly into a file. To do so, select a SQL Select statement in the SQL editor and hit the `ctrl + t` shortcut to open the tools pop-up. Then choose the sql2file function from the pop-up. Alternative, you can do this via the menu entry Session => Scripts => Store result of SQL in file

  After this, the control dialog appears. This dialog allows you to specify various options including the target file and options such as the data format. Be careful when choosing the MS Excel format as it requires the entire result set to be stored in memory. In this case, if the result set is large, SQuirreL SQL may run out of memory.
  The export is done on a new database connection, so the user can continue using SQuirreL SQL while exporting the data. A progress monitor shows the progress of the export and you can cancel it any time. When the export is complete, the progress dialog will be hidden.

Running query output directly into a file
To run query output directly into a file use the following syntax:
`@file '/tmp/customers.xlsx' SELECT * FROM customers`
This will write the result of 'SELECT * FROM customers' to the file '/tmp/customers.xlsx'. The settings for the output will be taken from the export dialog shown above.
Please note the single quotes around the file name.
Also note: Existing files will be replaced.