Dragging schema SQL
The easiest way to generate SQL for the whole schema or specific parts of it
is just to drag the relevant nodes of the schema tree to any text editor
understanding OLE drag-n-drop. Several nodes of the schema tree can be selected by holding
Ctrl or Shift keys, as usually.
The SQL code dropped into the target window depends on whether you are
viewing one or two databases, on the combination of Shift, Control and Alt keys
and on the target window itself. This might sound complicated, but in fact the logic
was designed to be very simple and intuitive, so most of the time you are getting just the
right kind of SQL with minimal mental efforts. And all the time you are dragging the data, one of
the special drag cursors indicates the operation to be performed.
One database is open, there is no comparison. When you
drag&drop, the resulting script would either CREATE or DROP the selected
objects. By default, CREATE statements would be generated. Holding any of the SHIFT, CTRL or ALT
key switches to DROP statements:
|
Keys
|
Cursor
|
Action
|
| |
 |
Generate CREATE statements |
| [Shift], [Ctrl] or [Alt] |
 |
Generate DROP statements |
Comparing two databases. When you are viewing the merged results of comparing two
databases, the
drag&drop can produce the CREATE, DROP or the difference SQL for the selected item(s).
Besides, you can choose either of the databases for CREATE/DROP or choose the
direction of synchronization for diff scripts. This gives you 6 combinations:
|
Keys
|
Cursor
|
Action
|
Reversed action
(with [Shift] key pressed)
|
Cursor
|
|
|

|
Generate CREATE statements from the left-hand database schema |
Generate CREATE statements from the right-hand database schema |
 |
|
[Ctrl] |
 |
Generate difference script to be applied to right-hand DB to synchronize
it with the left-hand one. |
Generate difference script to be applied to left-hand DB to synchronize
it with the right-hand one. |
 |
|
[Alt] |
 |
Generate DROP statements from the left-hand database schema |
Generate DROP statements from the right-hand database schema |
 |
Dropping to Code Viewer window. If there is no connection selected in
the Target combo box, the drag&drop operates as described above. Otherwise, the
currently selected Target is taken into consideration. Note that certain
combinations in the table below are grayed out. It means that sending that kind
of SQL to that target connection does not make sense and/or might not work (like
applying "CREATE" SQL to either of the DBs being compared):
|
Keys
|
Cursor
|
Action
|
Reversed action
(with [Shift] key pressed)
|
|
|
or

|
Generate difference script to be applied to the DB selected in the Target
combo-box to synchronize it with the other database. |
Generate difference script to be applied to the other DB to synchronize
it with the selected one. |
|
[Alt] |
or
 |
Generate DROP statements from the database selected in the Target
combo-box |
Generate DROP statements from the other database |
|
[Ctrl] |
or
 |
Generate CREATE statements from the other database schema. |
Generate CREATE statements from the selected database schema |
When some SQL is dropped to the CodeView without a selected target,
the selection is made automatically, if possible:
|