The text editor in dbForge Studio for SQL Server serves as both a general-purpose editor and a code editor. When editing plain text, it’s referred to as the text editor. When writing or editing SQL source code – its primary use – it’s called the code editor.
You can open multiple code editor windows to view and edit SQL code simultaneously. To manage open editor instances, use the Windows menu, which lists all active documents.
1. Open the New File dialog by doing one of the following:
On the top menu, select File > New > File > General > Text File or XML File> Create.
On the standard toolbar, click New File.
Note
The XML editor is similar to the text editor but includes syntax highlighting for XML content. You can customize XML highlighting and color settings in the Options dialog under Text Editor > Fonts and Colors.
The text editor consists of the following components:
The Text Editor toolbar provides quick access to features such as code completion, commenting and uncommenting code, bookmarks, and other editing tools.
The table describes the text editor toolbar options.
Icon | Name | Description |
---|---|---|
![]() |
Display an Object Member List | Shows a list of valid database objects, such as databases, tables, and columns. To insert a selected item into your code, press Tab , type a space, or type a period.Shortcut: Ctrl+K, Ctrl+L |
![]() |
Display a Parameter Info | Shows a list of parameters when you start typing a function or stored procedure and open the parenthesis ( .Shortcut: Ctrl+Shift+Space |
![]() |
Display Quick Info | Shows general information about an identifier when you hover over it. Shortcut: Ctrl+K, I |
![]() |
Display Word Completion | Suggests possible completions for the word you are typing. Shortcut: Ctrl+K, W |
![]() |
Refresh Suggestions | Updates a list of suggestions to reflect the changes. Shortcut: Ctrl+Shift+R |
![]() |
Enable/Disable Code Completion for current document | Enables or disables the code completion feature for the active document. |
![]() |
Decrease Line Indent | Moves the selected lines to the left by one level of indentation, for example, by removing a tab or leading spaces. |
![]() |
Increase Line Indent | Moves the selected lines to the right by one level of indentation, for example, by adding a tab or a specific number of spaces. |
![]() |
Comment out the selected lines | Turns the selected lines into comments, making them non-executable. Shortcut: Ctrl+K, C |
![]() |
Uncomment the selected lines | Removes comment markers from the selected lines, making the code executable. Shortcut: Ctrl+K, U |
![]() |
Toggle a bookmark on the current line | Adds or removes a bookmark on the selected line. Shortcut: Ctrl+K, K |
![]() |
Move the caret to the previous bookmark | Moves the cursor to the previous bookmark in the script. Shortcut: Ctrl+K, Ctrl+P |
![]() |
Move the caret to the next bookmark | Moves the cursor to the next bookmark in the script. Shortcut: Ctrl+K, Ctrl+N |
![]() |
Clear all bookmarks in the current document | Removes all bookmarks in the active document. Shortcut: Ctrl+K, L |
![]() |
Format Document | Automatically formats SQL code in the active document. Shortcut: Ctrl+K, D |
![]() |
Format Current Statement | Applies formatting to the SQL statement at the current cursor location. Shortcut: Ctrl+K, S |
![]() |
Analyze Code | Scans the SQL script to identify syntax errors, logical issues, and best practice violations before execution. |
You can quickly select a word, line, or block of text while working in the editor. Use your mouse or keyboard shortcuts to make selections efficiently.
To select a specific block of text, drag the mouse over the text.
To select a word, double-click that word or place your cursor next to the word and press Ctrl+Shift+Right Arrow/Left Arrow.
To select a line of text, drag the mouse over the line.
To select text from the cursor to the beginning of the current line, press Shift+Home.
To select text from the cursor to the end of the current line, press Shift+End.
The editor provides standard text editing functionality similar to most word processors and code editors. You can:
You can move through your code using the keyboard or mouse. The Code Editor supports several navigation methods:
Use the Go To Line command to navigate to a specific line number in your document.
To enable line numbers:
1. On the top menu, select Tools > Options.
2. In the Options dialog, go to Text Editor > General.
3. Select the Line numbers checkbox.
4. Click OK to save the changes.
To go to a specific line:
1. With the document open in the editor, on the top menu, select Edit > Go To Line.
2. In the dialog that appears, enter the line number.
3. Click OK to jump to the specified line.
You can change the case of selected text using menu commands or keyboard shortcuts.
To change text to uppercase:
1. Select the text you want to convert.
2. On the Edit menu, select Advanced > Make Uppercase, or press Ctrl+Shift+U.
To change text to lowercase:
1. Select the text you want to convert.
2. On the Edit menu, select Advanced > Make Lowercase, or press Ctrl+U.
Bookmarks help you navigate to frequently used sections in your code.
To create or remove a bookmark:
1. Open a file in the editor.
2. Place the insertion point on the line you want to add or remove a bookmark.
3. On the Text Editor toolbar, click Toggle a bookmark on the current line.
Alternatively, press Ctrl+K.
To move to a bookmarked line, do one of the following:
Note
Bookmarks work across files in the current solution or project.
You can personalize the appearance of SQL code elements, such as TODO lists or comments.
To change font settings:
1. On the top menu, select Tools > Options.
2. Navigate to Environment > Font and Colors.
3. In the Display items list, choose the item you want to modify.
4. Adjust the Font, Size, Foreground color, and Background color as needed.
5. Click OK to apply the changes.
View White Space mode displays spaces and tab characters.
To view white space:
1. Place the cursor anywhere in the editor.
2. On the top menu, select Edit > Advanced > View White Space.
Word Wrap moves any part of a long line that extends beyond the visible width of the SQL Editor onto the next visual line, so you can view the entire line without scrolling horizontally.
To use word wrap mode, do one of the following:
You can temporarily disable a section of SQL code by commenting it out.
To comment out a block:
1. Place the cursor on the line or select the block of code you want to comment.
2. On the top menu, select Edit > Advanced > Toggle Block Comment.
Alternatively, press Ctrl+Shift+/.
To make a previously commented block executable again, do one of the following:
To comment out selected lines of code:
1. Select the line or block of code you want to comment out.
2. Do one of the following:
On the top menu, select Edit > Advanced > Comment Selection.
On the toolbar, click Comment out the selected lines.
Press Ctrl+K, C.
To remove comment markers from selected lines of code:
1. Select the line or block of code you want to uncomment.
2. Do one of the following:
On the top menu, select Edit > Advanced > Uncomment Selection.
On the toolbar, click Uncomment the selected lines.
Press Ctrl+K, U.
To move selected lines to the right by one indentation level:
1. Select the lines you want to indent.
2. On the top menu, select Edit > Advanced > Increase Line Indent.
Alternatively, on the toolbar, click Increase Line Indent.
To move selected lines to the left by one indentation level:
1. Select the lines you want to unindent.
2. On the top menu, select Edit > Advanced > Decrease Line Indent.
Alternatively, on the toolbar, click Decrease Line Indent.
You can define collapsible regions in your SQL code to make long scripts easier to navigate.
To create an outlining region:
1. On a new line, type --region
followed by an optional region name.
Note
Only spaces are allowed before
--region
on the same line.
2. Add your SQL code below the --region
statement.
3. On a new line, type --endregion
to close the region.
Tip
You can also include the region name after
--endregion
for clarity.
--region Setup
SELECT * FROM Customers;
SELECT * FROM Orders;
--endregion Setup
You can collapse or expand the region using the outline indicators in the SQL Editor.
You can nest multiple regions to group related code blocks:
--region MainBlock
--region SubBlock
SELECT * FROM Products;
--endregion SubBlock
--endregion MainBlock
Nested regions help organize large scripts into logical, manageable sections.