User Guide > Views and Table Resources > Ad Hoc SQL and the SQL Scratchpad Editor > Opening the SQL Scratchpad Editor
 
Opening the SQL Scratchpad Editor
There is only one instance of the SQL Scratchpad editor. If it is already open but not the active editor, any of the three methods listed below makes it the active editor by bringing it to the front.
You can open the SQL Scratchpad from the Studio Modeler panel in one of three ways:
From the Studio menu bar, select File > Show SQL Scratchpad.
On the Studio toolbar, click the Show SQL Scratchpad button.
Press Ctrl+Q anywhere in the Studio window.
The short bar to the right of the status bar indicates the current line and column position of the cursor, separated by a colon. For example, 1:31 indicates that the cursor is on line 1, column 31.
You can type queries in the work area and add resources to the queries by:
Typing the paths and names of the resources
Dragging the resources from the Studio resource tree and dropping them onto the work area
Using the Add Resources button
The following table describes the actions you can perform in the SQL Scratchpad Editor toolbar.
Label
Use to...
Execute
Execute the SQL query currently displayed in the panel and opens the Result panel (The SQL Scratchpad Result Panel) below it, showing up to 50 rows of results. Each time you execute a unique SQL query, it is moved to the top of the list in the History panel.
Export to File
Open a dialog box to save the SQL query as a file.
Import from File
Open a dialog box to import a SQL query from a file.
Add Resources
Open a window where you choose a resource to add to the SQL Scratchpad editor.
Format Query
Format the SQL text according to the settings made on the Editors tab of the Studio Options window.
Toggle Syntax Highlighting
Change between displaying all SQL text in the same font color (usually black) and displaying comments, keywords and literals in the colors you selected in the Editors tab of the Options dialog box.
Show/Hide History View
Display or hides a History pane along the right side of the SQL Scratchpad editor. (See The SQL Scratchpad History Pane).
Show Option Dialog
Open the Studio Options window to the SQL Scratchpad tab, where you can change the options for this window.