Creating an SQL statement using the SQL scrapbook
The SQL scrapbook is similar to a basic text editor. You can open it and immediately start typing your SQL statement in it, without having to specify what kind of statement you want or importing any database tables into the workbench. You can also execute the SQL statement directly against the database.
Prerequisite: To open the SQL scrapbook, have established a connection to a database (see Connecting to a database using a wizard).
To create an SQL statement in the SQL scrapbook:
- Switch to the Database Explorer view in the Data perspective. The connection you select is used when you execute the statement.
- Right-click the database connection that you want to work with, and then click Open SQL Scrapbook on the pop-up menu. The SQL scrapbook opens.
- Type the text of the statement in the SQL scrapbook. You can use the Content Assist and Content Tip commands on the pop-up menu in the SQL scrapbook to help you create your statement.
After you have completed the statement, you can execute it by clicking SQL > Execute. Refer to the related task for more details.
To save the statement, click SQL > Save to Model. When you save a statement, you can specify a name and type for it, as well as the database with which to associate the statement.
Saving an SQL statement in the SQL scrapbook
When you save a statement in the SQL scrapbook, you can specify a name and type for the statement, as well as the database with which to associate the statement.
Parent topic
SELECT, UPDATE, INSERT and DELETE statements. The SQL Builder also supports WITH (DB2 only) and FULLSELECT statements. Any statement that you create is stored in a file with the extension .sqx.">Creating an SQL statement
Related tasks
Executing an SQL statement