SQL Server Management Studio Database Engine Query Editor Window - Microsoft Docs
SQL Server Management Studio Database Engine Query Editor Window - Microsoft Docs
Features
Type scripts in the Query Editor window.
To execute scripts, press F5; or click Execute on the toolbar; or on the Query menu,
click Execute. If a part of the code is selected, only that part is executed. If no code is
selected, all the code in the Query Editor is executed.
To obtain help with Transact-SQL syntax, select a keyword in Query Editor, and then
click F1.
For dynamic help with Transact-SQL syntax, on the Help menu, click Dynamic
Help. This opens the Dynamic Help component. With Dynamic Help, help topics
appear in the Dynamic Help window when keywords are typed in the Query Editor.
The Query Editor supports IntelliSense functionality, such as word and parameter
completion. For more information, see Using IntelliSense.
7 Note
Th Q Edit id th T t SQL d b th t t
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008/ms177264(v=sql.100)?redirectedfrom=MSDN h l d b 1/6
3/21/2020 SQL Server Management Studio Database Engine Query Editor Window | Microsoft Docs
The Query Editor provides the Transact-SQL debugger that you can use to help debug
Transact-SQL scripts and statements. For more information, see Using the Transact-
SQL Debugger.
In a Messages tab at the bottom of the window for errors that are returned by the
SQL Server Database Engine.
In the Error List window for errors that are generated by IntelliSense. For more
information, see Error List Window (Management Studio).
In the Output or Immediate windows for errors that are generated by the
Transact-SQL debugger.
Connect
Opens the Connect to Server dialog box. Use this dialog box to establish a
connection to a server.
Disconnect
Disconnects the current Query Editor from the server.
Change Connection
Opens the Connect to Server dialog box. Use this dialog box to establish a
connection to a different server.
Available Databases
Change the connection to a different database on the same server.
Execute
Executes the selected code or, if no code is selected, executes all the code in the
Query Editor.
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008/ms177264(v=sql.100)?redirectedfrom=MSDN 2/6
3/21/2020 SQL Server Management Studio Database Engine Query Editor Window | Microsoft Docs
Debug
Enables the Transact-SQL debugger. This debugger supports debugging actions such
as setting breakpoints, watching variables, and stepping through code.
Parse
Check the syntax of the selected code. If no code is selected, checks the syntax of the
all code in the Query Editor window.
Query Options
Opens the Query Options dialog box. Use this dialog box to configure the default
options for query execution and for query results.
IntelliSense Enabled
Specifies whether IntelliSense functionality is available in the Database Engine Query
Editor.
Results to Text
Returns the query results as text in the Results window.
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008/ms177264(v=sql.100)?redirectedfrom=MSDN 3/6
3/21/2020 SQL Server Management Studio Database Engine Query Editor Window | Microsoft Docs
Results to Grid
Returns the query results as one or more grids in the Results window.
Results to File
When the query executes, the Save Results dialog box opens. In Save In, select the
folder in which you want to save the file. In File name, type the name of the file, and
then click Save to save the query results as a Report file that has the .rpt extension.
For advanced options, click the down-arrow on the Save button, and then click Save
with Encoding.
Comment Selection
Makes the current line a comment by adding a comment operator (--) at the
beginning of the line.
Uncomment Selection
Makes the current line an active source statement by removing any comment
operator (--) at the beginning of the line.
You can also add the SQL Editor toolbar by selecting the View menu, selecting Toolbars,
and then selecting SQL Editor. If you add the SQL Editor toolbar when no Database Engine
Query Editor windows are open, all the buttons are unavailable.
When a Database Engine Query Editor window is open, you can add the Debug toolbar by
selecting the View menu, selecting Toolbars, and then selecting Debug. If you add the
Debug toolbar when no Database Engine Query Editor windows are open, all the buttons
are unavailable.
Continue
Runs the code in the Database Engine Query Editor window until a breakpoint is
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008/ms177264(v=sql.100)?redirectedfrom=MSDN 4/6
3/21/2020 SQL Server Management Studio Database Engine Query Editor Window | Microsoft Docs
Runs the code in the Database Engine Query Editor window until a breakpoint is
encountered.
Break All
Sets the debugger to break all processes to which the debugger is attached when a
break occurs.
Stop Debugging
Takes the selected Database Engine Query Editor window out of debug mode, and
restores the standard execution mode.
Step Into
Run the statement after the current statement.
Step Over
Skip the statement that is immediately after the current statement and run the
statement that follows that one.
Step Out
Step back to the next highest calling level (function, stored procedure, or trigger).
Windows
Opens either the Breakpoint window or the Immediate window.
See Also
Reference
Concepts
Writing, Analyzing, and Editing Scripts with SQL Server Management Studio
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008/ms177264(v=sql.100)?redirectedfrom=MSDN 5/6
3/21/2020 SQL Server Management Studio Database Engine Query Editor Window | Microsoft Docs
Other Resources
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008/ms177264(v=sql.100)?redirectedfrom=MSDN 6/6