A SQL document is a workspace where you can write, edit, execute T‑SQL statements against SQL Server databases, debug database objects, and view or manage the results those statements return.
A SQL document uses a .sql file extension and includes the main views:

To open a SQL document, do one of the following:
In Database Explorer, right-click a required server connection or a database, then select New SQL.
On the standard toolbar, click
New File, then click SQL Server > SQL File > Create.
SQL document supports two types of view layouts: Split Layout (default option) and Combined Layout.
To switch to a combined document layout, in the bottom-right corner of the SQL document, click
Combined Layout.
The combined layout lets you see only one view at a time.

To switch to a split document layout, in the bottom-right corner of the SQL document, click
Split Layout.
In the split layout, a SQL document is divided into two areas:

Right-click anywhere in the SQL Editor and select the required option.
| Name | Description |
|---|---|
| Insert Snippet | Inserts a code snippet at the cursor location. Shortcut: Ctrl+K, X. |
| Cut | Cuts the selected fragment from the script. Shortcut: Ctrl+X |
| Copy | Copies the selected fragment to the clipboard. Shortcut: Ctrl+C |
| Paste | Inserts the copied fragment into the script at the cursor location. Shortcut: Ctrl+V |
| Execute | Executes the script. Shortcut: F5 |
| Run on Multiple Targets | Opens the Run on Multiple Targets dialog, where you can select multiple databases to run the script on. |
| Execute Current Statement | Runs only the SQL statement, where your cursor is currently positioned. Shortcut: F8 |
| Execute To Cursor | Executes a script to the current position of the cursor. Shortcut: Ctrl+Shift+F10 |
| Start | Launches the current script in debug mode. Shortcut: Alt+F5 |
| Run To Cursor | Debugs code until execution reaches the cursor, where the debugger pauses so you can step through the code. Shortcut: Ctrl+F10 |
| Insert Breakpoint | Inserts a breakpoint in the code at the cursor location. |
| Go To Definition | Navigates to the Object Editor for the object, where the cursor is placed. Shortcut: F12 |
| Jump Between Syntax Pairs | Navigates between paired syntax constructions, such as BEGIN...END, BEGIN TRY...END TRY, BEGIN CATCH...END CATCH, CASE...END.Shortcut: Ctrl+F12 |
| Disable Code Completion | Disables the code completion feature. |
| Refactoring > Rename | Allows you to rename the object identifier where the cursor is placed. Shortcut: F2 |
| Refactoring > Insert Semicolons | Inserts semicolons. Shortcut: Ctrl+K ; |
| Convert EXEC to Script | Replaces the EXEC statement with the inline SQL code that the stored procedure contains. |
| AI Assistant > Explain SQL | Creates a request in a new AI chat to explain the selected code fragment. |
| AI Assistant > Optimize SQL | Creates a request in a new AI chat to optimize the selected code fragment. |
| AI Assistant > Fix SQL | Creates a request in a new AI chat to identify potential issues and suggest fixes for the selected code fragment. |
| AI Assistant > Send Selection To New Chat | Opens a new AI chat and inserts the selected fragment into the input field. |
| Analyze Code | Enables the T-SQL Code Analyzer that validates your code. |
| Format > Format Document | Formats the query document. Shortcut: Ctrl+K, D |
| Format > Format Selection | Formats the selected query document or code fragment. Shortcut: Ctrl+K, F |
| Format > Format Current Statement | Formats the current SQL statement. Shortcut: Ctrl+K, S |
| Format > Active Format Profile > format profile | Applies the chosen format profile to the current SQL statement or selected code fragment. |
| Format > Active Format Profile > Edit Format Profiles | Opens the Options > Text Editor > Format > Profiles dialog, where you can edit a format profile, create a new one, or set a profile as active. |
| Settings > Query Execution Options | Opens the Options > Query Execution > General dialog, where you can set up query execution options. |
| Settings > Options | Opens the Options dialog, where you can manage and personalize the environment, editors, execution settings, and IDE behavior to match your preferences. |
Use the toolbar above the results grid to adjust the data appearance in the grid.
To work with a specific row, right-click it and select the option.
The table describes the shortcut menu options.
| Name | Description |
|---|---|
| Refresh | Updates the results grid to reflect any changes. Shortcut: F5 |
| Copy | Copies the data from the selected row to the clipboard. Shortcut: Ctrl+C |
| Copy With Headers | Copies columns with their headers. Shortcut: Ctrl+Shift+C |
| Copy Data As | Copies the selected data from the grid into different formats, allowing you to paste it elsewhere, such as Excel, a text editor, email, or a report. |
| Copy Data As > Copy Column Names Only | Copies only the column headers as text. |
| Copy Data As > Copy Column Names and Types | Copies column headers along with their data types. |
| Copy Data As > CSV | Copies the selected data as a .csv file to the clipboard or saves it to a file. |
| Copy Data As > XML | Copies the selected data as an .xml file to the clipboard or saves it to a file. |
| Copy Data As > HTML | Copies the selected data as an .html file to the clipboard or saves it to a file. |
| Copy Data As > JSON | Copies the selected data as a .json file to the clipboard or saves it to a file. |
| Copy Data As > EXCEL | Copies the selected data as an .xls file to the clipboard or saves it to a file. |
| Paste | Inserts the copied data into the grid. Shortcut: Ctrl+V |
| Paste As New Records | Inserts the copied data as new records instead of replacing existing rows. |
| Set Value To | Lets you set the value of the selected cells to a common default or special value. |
| Set Value To > NULL | Sets the cell value to NULL.Shortcut: Ctrl+0 |
| Set Value To > Empty String | Sets the cell value to an empty text string (''). |
| Set Value To > Now | Sets the cell value to the current date and time. |
| Set Value To > Zero | Sets the cell value to 0. |
| Append | Adds a new empty row at the bottom of the grid for entering new data. Shortcut: Ins |
| End Edit | Finishes editing the current cell and saves the changes. |
| Cancel Edit | Discards the editing and reverts the cell to its previous value. |
| Delete | Deletes the selected row from the grid. Shortcut: Ctrl+Del |
| Quick Filter | Instantly filters rows in the grid based on the selected values or conditions. Select the required option from the shortcut menu. |
| Visible Columns | Opens the Visible Columns dialog, where you can clear the checkboxes next to the columns you want to hide. |
| Clear Sorting | Clears column sorting. |
| Data Layout > Grid View | Displays data in the grid view. |
| Data Layout > Card View | Displays data as cards. |
| Auto-search mode | Enables the auto-search mode. Shortcut: Ctrl+I |
| Data Viewer | Opens the Data Viewer window. Shortcut: Ctrl+W, R |
| Export Data | Opens the Data Export wizard to export data to a required file format. |
| Generate Script As | Creates ready‑to‑run SQL scripts of database objects without writing them manually. |
| Generate Script As > INSERT | Generates an INSERT script of the selected object to a new SQL document, a file, or to the clipboard. |
| Generate Script As > BULK INSERT | Generates an INSERT script of the selected object to a new SQL document, a file, or to the clipboard. |
| Generate Script As > INSERT #tmpTable | Generates an INSERT statement that inserts data from the query result into a temporary table - #tmpTable. |
| Generate Script As > WHERE IN() | Generates a WHERE script of the selected object to a new SQL document, a file, or to the clipboard. |
| Generate Script As > WHERE AND OR | Generates a WHERE clause combining selected cell values with AND (within rows) and OR (across rows) to a new SQL document, a file, or to the clipboard. |
| Generate Script As > UPDATE | Generates an UPDATE clause of the selected object to a new SQL document, a file, or to the clipboard. |
| Send to > Query Builder | Opens your current SQL query in the Query Builder diagram. |
| Send to > Data Report | Opens your current SQL query in the data report. |
| Send to > Chart Designer | Opens your current SQL query in the chart. |
| Send to > Pivot Table | Opens your current SQL query in the pivot table. |
| Opens the Preview, where you can print, export, or view data. Shortcut: Ctrl+P |
|
| Options | Opens the Options > Data Editor > General dialog, where you can customize the Data Editor settings. |
In the bottom panel, you can:
To swap document views, click
Swap main and additional document views.
To open a new document view, click
Open document view, then select the required view on the menu.
1. Select the view you want to hide.
2. Click
Open document view, then select Hide on the shortcut menu.
To show all views, click
Open document view, then select Show All Views on the menu.
An asterisk (*) in the document name on the tab title indicates unsaved changes.
To save and apply them, on the standard toolbar, click
Save As, or press Ctrl+S. In the dialog that opens, specify the path to store the file and its name, and click Save.