SQL Editor overview
Last modified: March 28, 2025
SQL document is an essential part of every database tool in the dbForge product line. It is a place where you create SQL statements in order to run them against a database server. This topic gives you an overview of SQL document layout, views, and functions.
To create a new SQL Document, click New SQL on the Standard toolbar.
The following image is an example of an SQL document.
Note
The actual document look may slightly vary from the image above, depending on the product you use.
SQL Document overview
Each SQL document includes different representations of the content. They are called document views. In the above screenshot, you can see two document views: Text and Data.
- Text view comprises the SQL Editor, which allows you to write SQL statements.
- Data view, typically shown after a query is executed, comprises the Data Editor that displays the result sets returned by a database server.
To switch to a specific view:
- Click a button with a view name on the bottom panel of the document.
- Right-click the bottom panel of the document to open the shortcut menu and select a view from the list.
Represent query execution results
The query execution results can be represented in two ways - in the Grid and Card Views.
1. To represent results as a grid, click Switch to Grid View on the SQL toolbar. The following image represents a sample of query execution results in the grid format.
Moreover, the grid view allows grouping the execution results by box. To test the feature, click Show Group by Box and drag a column header to the designated area:
The query execution results will look as follows:
2. To view the results as cards, click Switch to Card View on the SQL toolbar. The following image represents a sample of query execution results in the card format.
Document layout
SQL document has two types of view layout: Split Layout and Combined Layout. To switch document layout, use the corresponding buttons at the bottom-right corner of the document.
Split layout
In the split layout, a document is divided into two horizontal areas:
1. Text—the SQL document you are working with.
2. Data—the query execution result.
A document has one prominent (main) view, which is aligned to the top of the document viewport. Other views are called additional, they are displayed in the bottom area of the document viewport.
To change the main document view, use Swap main and additional documents views () to swap the main view and active additional view.
Combined layout
In the combined layout, you can see only one view at a time.
Text selection
There are three ways to select a block of SQL code:
1. Shift + navigational keys, Page up, Page down, Home, and End.
2. Shift + Alt + navigational keys, Page up, Page down, Home, and End.
3. Using the mouse.
Bookmarks
dbForge Transaction Log allows adding a bookmark to any part of your SQL document. This feature saves not only a particular line in the code but also the cursor position.
To add a bookmark, click Toggle a bookmark on the current line or press Ctrl+K, K.
In order to navigate the bookmarks:
-
Click
Move the caret to the previous bookmark or use the Ctrl+K, Ctrl+P hot keys.
-
Click
Move the caret to the next bookmark or use the Ctrl+K, Ctrl+N hot keys.
To delete all bookmarks in the current document, click Clear all bookmarks in the current document or press Ctrl+K, L.
Code folding
In case you are working with a large script, you might need to collapse some of the clauses for convenience. If you hover over the collapsed clause, you will see its content.
Status bar
The status bar contains the most important information regarding the current connection and query execution.
where:
- Connected is a connection status
- demo\SQLEXPRESS (15) is a host (server version)
- sa is a username
- AdventureWorks2022 is a selected database
When you execute a query, the query execution status and the query execution time will be displayed in the status bar.
- Query executed successfully is a query execution status
- 00:00:03.816 is the execution time
- demo\SQLEXPRESS (15) is a host (server version)
- sa is a username
- AdventureWorks2022 is a selected database
Comment the code
To comment on the part of the SQL code, select it and click Comment out the selected lines on the standard toolbar. Alternatively, press CTRL+K, C.
To uncomment a section, select it and click Uncomment the selected lines on the standard toolbar or use the CTRL+K, U keyboard shortcut.