The Result window of the SQL Editor shows the recordsets that were retrieved as a result of the database query. If an SQL Editor window contains more than one query, the results are displayed either in individual tabs or stacked in a single window, depending on configured options, see Viewing Results.
The status bar at the bottom of the window displays information on the progress of the query: whether the retrieval executed successfully, was aborted or has been stopped by the user. In addition, the number of rows and columns retrieved as well as the amount of time necessary for retrieval, and the time when the query was executed.
|Note:||In DatabaseSpy, a maximum number of 30 result tabs is allowed. If you execute a query that would produce more than 30 result tabs, only the first 30 result tabs are generated and a corresponding message is displayed in the Message window.|
When you right-click anywhere in the Result window of the SQL Editor, a context menu opens which provides options for working with the results of a query. Note that the available options in the content menu change dynamically, depending on the command you used for retrieving the data in the Result window. The Result window can, therefore, be in three different states: Execution was successful, Stopped retrieval, or Editing mode.
Execution was successful
The message indicates that the SELECT query has been executed successfully. This enables the following commands in the toolbar and in the context menu.
Go to statement
Jumps to the SQL Editor window and highlights the group of SQL statements that produced the respective result.
Auto Size Columns
Adjusts the column width of all columns to provide an optimized view of text contained in the columns. Please note that the maximum column width for auto-sizing in the Result window is 250 pixels. In data cells containing a large amount of text, only the first part of the text is displayed followed by an ellipsis (...). You can, however, always drag the column border to show more text.
Allows you to select the row or column in which the cursor is currently positioned, or the entire table. Choose the desired option from the sub-menu.
Opens a sub-menu to sort the table either ascending or descending and uses the column where the cursor is currently positioned as a sort key. To restore the default sort order, choose the corresponding option from the sub-menu.
Copy selected cells
Copies the selected cells to the clipboard. You can select several individual cells by holding down the Ctrl button and clicking the desired cells or select a consecutive number of neighboring cells by clicking a cell and pressing the Shift key while clicking a second cell. The content of the cells can be pasted as tabbed text into a text editor or spreadsheet calculator, or can replace existing cells in the result grid. This menu option is only available if data editing in the Result window is enabled.
Copy selected cells with header
Copies the selected cells as well as the corresponding headers (i.e., the column names) to the clipboard.
Show in Data Inspector Window
Opens the Data Inspector window where you can conveniently view the content of large data cells.
Show result toolbar
Shows or hides the toolbar in the Result window of the SQL Editor window.
currently not available
Hides the Results window. In order to show it again, click the Toggle Result Window(s) button in the toolbar of the SQL Editor window or choose the menu option SQL Editor | Result view.
The message indicates that the SELECT query has finished retrieving the first n rows. The query has been started by right-clicking tables, columns or views in the Online Browser and selecting Retrieve data | First n rows from the context menu. In this mode, the following additional options are available in the Result window:
Retrieve next n rows
Retrieves the next n rows from the query in the active SQL Editor window.
Retrieve outstanding rows
Retrieves all the remaining rows from the query in the active SQL Editor window.
The message indicates that data in the Result window can be edited. The query has been started by executing a SELECT statement with the Execute for Data Editing command, or by right-clicking tables, columns or views in the Online Browser and selecting Edit data from the context menu. When the SQL Editor is in the Editing mode, the following additional options are available in the Result window:
Pastes the content of the clipboard into the cell—and, if applicable, its neighboring cells—where the cursor is currently positioned. Note that if you use the Edit cell command before pasting, the entire content of the clipboard will be pasted into the selected cell as tabbed text.
Paste as new rows
Adds new rows to the result grid and pastes the content of the clipboard into the new rows. Note that only content that has been copied using the Copy selected cells command can be pasted as new rows.
Enables the data cell for editing and selects the content of the cell. This menu option is only available if no limitations with regard to editing records apply.
Resets the cell to the NULL value.
Resets the cell to the default value. This menu option is only available if a default value has been defined for the cell.
Undo Changes for this Cell
Rejects the changes that have been made to a data cell but not yet committed to the database.
Append a new row
Adds a new line to the result grid, where you can add records to the database table. The data must be committed to the database by clicking the button. This menu option is only available if no limitations with regard to adding records apply.
Deletes the row in which the cursor is currently positioned. This menu option is only available if no limitations with regard to deleting records apply.
In addition, the toolbar provides the following commands:
Opens a Find dialog box allowing you to search a particular string in the Result window.
Maximize result view
Enlarges the size of the Result window to a maximum.
Undo all changes
Rejects all changes that have been made in the result grid since the data has been selected from the database or since updated data has last been committed to the database, respectively. This toolbar option is only available if the Result window is in the Editing mode.
Pins the Result window so that it remains visible even if other queries are executed in the same window.
When the Result window is in editing mode and XML columns are present in the current grid, the following menu opens if you click the button:
Load XML Document from File...
Opens the standard Windows Open dialog box from where you can choose an XML file to load into the selected cell in the result grid.
Save XML Document to File...
Opens the standard Windows Save As dialog box where you can choose a location to save the content of the selected cell as XML file.
Assign XML Schema...
Applicable only for DB2 databases. Opens a dialog box where you can assign an XML schema for validation of the XML file stored in the database field.