Test DDL Script Statements

As you develop your database model you might want to execute and test ad hoc SQL Queries for a DDL script, to check that statements give you the results you need. You can do this using the Database Builder SQL Scratch Pad to execute queries against a live database and review any returned results and messages. The Scratch Pad requires a valid ODBC connection; before you can execute the SQL the system will, by default:

·Use the current active connection specified in the Database Builder, or
·Automatically activate the single connection specified in the Database Builder, or
·If there are several connections specified but none active, display a message prompting you to select from the list of possible connections, or
·If there are no connections defined, prompt you to create one

Access     Tools | Database Builder > SQL Scratch Pad

 
The Scratch Pad consists of:

·An editor panel in which you create or import the SQL Queries - this panel provides the facilities of the Common Code Editor
·A toolbar providing facilities for importing, saving, executing and clearing the SQL Queries
 
SQL ScratchpadTB
 
·A text panel consisting of a tab to show the results of executing the SQL Query, and a tab to display any messages generated during the execution

 

Scratch Pad Facilities

The Scratch Pad facilities are accessed through the Toolbar and are, from left to right:

Option

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

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

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

 

Save As

Save the currently-displayed Query to a new 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 Scratchpad.

 

Notes

·SQL statements on the SQL Scratch Pad are not attached to any DDL script
·The SQL Scratch Pad does not manipulate your SQL in any way, so you must apply the correct syntax of the DBMS question

 

Learn more