Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

SQL Scratch Pad

The SQL Scratch Pad provides a mechanism to develop and run ad-hoc SQL Queries against a live database. While you develop your data model you might want to execute and test ad-hoc SQL Queries for a DDL script, or run enquiries on the live database; all of this is possible within the Enterprise Architect Database Builder interface.

The SQL Scratch Pad requires the Database Builder to have a valid ODBC connection to a live database. This database connection is shared between the 'SQL Scratch Pad', 'Database Compare' and 'Execute DDL' tabs of the Database Builder.

Access Tools | Database Builder > SQL Scratch Pad

The Scratch Pad consists of:

  • A toolbar providing facilities for importing, saving, executing and clearing the SQL Queries
  • An editor panel in which you create or import the SQL Queries - this panel provides SQL-based syntax highlighting for the current data model
  • A tabbed panel consisting of two pages, one to show the results of executing the Query and one to display any messages generated during the execution

The Scratch Pad Toolbar

The functionality of each button on the Scratch Pad Toolbar is described in this table, working from left to right.

Button

Action

Run SQL

Execute the SQL Query currently shown in the Scratch Pad.

Check the 'Results' and 'Messages' tabs for the output of executing the Query.

Open

Load an SQL Query from file.

A source file browser displays, defaulted to display SQL files. Click on the file name and on the Open button to display the file contents in the Scratch Pad.

Save to SQL Query

Save this SQL statement to the SQL Query object it came from.

Save to New SQL Query

Create a new SQL Query object and save this statement to that object.

Save to File

Save the currently-displayed Query to the file it came from.

If you created the Query from scratch, a source file browser displays in which you type the new file name and click on the Save button to save the Query.

Save to New File

Save the currently-displayed Query to a new .sql file.

A source file browser displays on which you type in the new file name and click on the Save button to save the Query.

Clear

Clear the contents of the Scratch Pad.

Any Query displayed in the Scratch Pad remains there until you either replace it with another Query from file or you close the model. If you want to clear the Scratch Pad to create a new Query from scratch, click on this option.

Help

Display the Help on the SQL Query Scratch Pad.

Notes

  • The SQL Scratch Pad does not manipulate your SQL in any way, so you must use the correct syntax for the current DBMS
  • The SQL Scratch Pad can only execute 1 SQL statement at a given time

Learn more