Nov 12, 2009

Creating SQL Data script from a table within SquirrelSQL.

To access a database, I'm using the SQuirreL-SQL-Tool. It's available on
sourceforge and supports all necessary functions I need.

The IDE supports a function to create Insert-Statements from the whole table.

To do this,
  • open the Object-Tree 
  • select the table you like
  • press the right mouse button to get the context menu
  • go to scripts
  • and select Create Data Script

So for my purpose, this is to much data, I will get, because I like to transfere
just one row of data.

This is also possible, but not as easy to find:

Go into the SQL Editor and write down your select statement.

Put the cursor on your statement and press -t.
This opens a correction window, where you use sql2ins. This
creates your insert-statement with the data from the rows returned by
your previously entered select statement.

This screenshot shows an already inserted insert-Statement from before and
the popup narrowed down to sql2ins which you get by pressing -t.

It is described in the HELP of SQuirreL in the section "SQL Scripts Plugin".