Most of edit menu's functions are enabled when the cursor is in
SQL Editor (Query Analyzer) window. However, some functions are still available when the cursor is in
Result Set window.
Edit menu helps manipulate with text data. For instance, you can undo the latest change, cut/copy/paste the selected piece and make some cosmetic changes to the text.
Here is the list of all the functions you can access via Edit menu.
1.
Undo - cancels the effect of the last change in SQL editor.
2.
Redo - redoes an action that you undid in SQL editor.
3.
Cut - cuts out the selected text fragment in SQL editor.
4.
Copy - copies the selected text fragment in SQL editor.
5.
Copy with Headers - works only for result set window by copying selected rows with their tables' headers from the result set.
6.
Paste - pastes text from clipboard straight to SQL editorr.
7.
Find - opens a Find window and allows the user to use additional find options like: Match case, Match the whole world and search up. Works for SQL editor.
8.
Find Again - remembers the latest search criteria and performs the search using these criteria without bringing up any additional pup-up windows. Works for SQL editor.
9.
Replace - opens a Find and Replace window prompting the user to specify what element to find and what element to replace it with. Works for SQL editor.
10.
Goto Line - opens a Goto Line window prompting the user to specify a text line to jump to. Works for SQL editor.
11.
Bookmarks -
There are often some sets of SQL statements that are used over and over to perform frequent tasks while working with a database. This is a perfect opportunity to start using bookmarks in the SQL editor. You can find Bookmarks under Edit >> Bookmarks menu. Use a bookmark to conveniently mark various locations in the code and quickly move about in the text without searching through the code and losing your current editing location. You can set up to ten numbered bookmarks and unlimited amount of 'simple' (unnumbered) bookmarks.
For example, you could place bookmark number 1 in the beginning of a complicated SQL statement you want to have quick access to, and bookmark number 2 at your current editing location. Then, to quickly go to the SQL section, you would simply need to press Ctrl+Alt+1. After looking at your SQL statement, you would return to your editing location by pressing Ctrl+Alt+2.
To set a numbered bookmark, or to go to a bookmark that you previously set, you can use keyboard shortcuts or use Edit menu. To set a bookmark using a keyboard shortcut press Ctrl+Shift+Alt+<marker bookmark number>. For example, to set marker bookmark number 1, press Ctrl+Shift+Alt+1.
To go to a bookmark using a keyboard shortcut press Ctrl+Alt+<marker bookmark number>. For example, to go to a marker bookmark number 1, press Ctrl+Alt+1.
To set a simple (unnumbered) bookmark or delete any bookmark at cursor, press F9. To go to next or previously set bookmark press Ctrl+Alt+Right or Ctrl+Alt+Left respectively.
Please note, that some graphic cards in Windows OS also support key combinations like Ctrl+Alt+Right and Ctrl+Alt+Left. Make sure to check this in graphical card settings prior to using them in the Workbench: the keys are usually responsible for rotating a picture on the screen clockwise and counterclockwise.
You can also enable/disable a specific bookmark of your choosing. This will make the bookmark marker invisible to navigation via ‘go to next/previous bookmark’ option. To do that, move a cursor to the line where the bookmark is set and select Edit >> Bookmarks >> Enable/Disable bookmarks. This will disable previously set bookmark.
To enable the bookmark perform the same actions.
To clear all the bookmarks select Edit >> Bookmarks >> Clear Bookmarks.
The above example shows 3 set bookmarks. The first bookmark (left from select 1 statement) is unnumbered and enabled bookmark. The second bookmark (left from select 2) is numbered and disabled. The third bookmark is numbered and enabled.
12.
Advanced. Advanced options to work with text in query analyzer are:
-
Comment selection - adds comment symbol "--" for the whole line of text the cursor is at.
- Uncomment selection - removescomment symbol "--" for the whole line of text the cursor is at.
- Tabify selected lines - lines up the spaces at the beginning of the line with tabs.
- Untabify selected lines - removes lining up for spaces.
- Make selection Upper case - makes only the selected text UPPER CASE.
- Make selection lower case - makes only the selected text lower case.
- Change selection cASE - changes lower case symbols to upper case symbols and vice-versa.
13.
Outlining - By default, all code is visible in each query analyzer tab.
Outlining allows you to
expand or
collapse the regions in query analyzer. This feature might also help make the code more compact and readable by hiding unnecessary lines under 'Region' clause. A region’s boundaries are defined by the following text: ‘
-- region RegionName’ - to mark the beginning of the region, and ‘
--endregion’ to mark the end. To create a region, simply type this text in the query analyzer:
Note: the "RegionName" text shown on the picture above is optional. Workbench also supports nested regions:
A vertical line on the left edge of the editor window uses a square with a minus sign (-) to identify the start of each collapsible code region. When you click a minus sign, the text of the code region is replaced with a box that contains a region’s name or three dots if the region name was not specified (…), and the minus sign changes to a plus sign (+). When you click a plus sign, the collapsed code appears and the plus sign changes to a minus sign. If you move the pointer over a box that has three periods or a region’s name, a tooltip appears that shows the code in the collapsed region.
If you select
Collapse, the result will look like shown below.
Go up | Go To
WorkBench Help page