Esat Erkec
Query Results to Text

Overview of Microsoft SQL Server Management Studio (SSMS)

January 27, 2020 by


Microsoft SQL Server Server Management is an advanced development environment that enables us to configure, manage and administrate SQL Server database engines. SSMS is very popular and widely used by the database developers and administrators because of the following advantages:

  • Cost-free
  • Advanced user experience
  • Various add-in options
  • Easy installation

Firstly, we will learn the installation and then go through the other details of the SSMS.


We can download the latest version of the SSMS from the Microsoft download website and we can also find out the release notes.

After downloading the setup file, we will open the setup file and click the install button in order to begin the installation. On this screen, the Location setting specifies the installation path of the Microsoft SQL Server Management Studio:

Starting installation of Microsoft SQL Server Management Studio

In the second screen, the installation process will be started and the progression of the setup will be shown:

SSMS installation "Package Progress and Overall Progress" screen

After the installation is completed, the following screen will appear and inform us that the installation has been completed successfully:

SSMS installation "Setup Completed" screen

Now, we can launch SSMS from the Start menu:

Starting Microsoft SQL Server Management Studio from the Start menu

Also, we can use the Command Prompt to launch SSMS:

Starting Microsoft SQL Server Management Studio from Command Prompt

Connecting to the Database Engine

When we launch the SSMS, the Connect to Server dialog screen will appear in front of us. In this screen, we will set the Server name and Authentication type of the SQL Server which we want to connect to and then click the Connect button. In the following illustration, we will connect to a SQL Express edition with the SQL Server Authentication type. If we click on the Remember password option, SSMS will remember our username and password for the next connection of the same SQL Server instance:

Connect to a database through the SSMS

After a successful connection, the Object Explorer panel will appear on the left side of the main window of Microsoft SQL Server Management Studio.

On the Object Explorer, we can change various settings of the SQL Server Engine and deployed databases. This screen provides us to accomplish database related operations such as the backup, restore, detach, etc.:

Object Explorer right-click menu in Microsoft SQL Server Management Studio

At the same time, this screen helps us to maintain and manipulate the database objects.

Tip: Object Explorer Details panel helps us to find out more details about the server and database objects which are located under the selected folder. By default, this panel will be invisible, but we can open it under the View menu:

Object Explorer Details panel in SSMS

For example, if we want to obtain more details about the tables which are contained by a particular database, selecting the tables folder will be enough to see these details. In addition, we can also add different data to this tabular list according to the type of the object. For example, it allows seeing the record number of rows for the tables:

Showing tables row count in the Object Explorer Details

Query Editor on Microsoft SQL Server Management Studio

Another ability of the SSMS is that it enables to create and execute the T-SQL queries. When we click on the New Query button, which is placed on the toolbar, a new Query Editor will open. In this editor, we can create and execute SQL queries. In the following example, we will execute a very basic query that shows some of the synthetic customer data. First, we will open a new query editor window, type desired query and then, we will click the Execute button to run the query. The query result will be shown under the Results panel:

Executing a query from the Query Editor

SSMS query editor offers various productivity options to programmers. In the previous example, the result set of the query has been shown on the grid, but we can change this option. On the SQL Editor toolbar, we can change this setting to Results to File, so that the result set of the query will be shown in a text format:

Query Results to Text

When we want to separate the query window and result set window, we need to enable the Display results in a separate tab option. To enable this option we need to follow the below steps:

  • Click the Options command which is placed under the Tools menu:

    SSMS Option menu

  • Enable the Display results in a separate tab option under either Results to Grid tab or Results to Text tab:

    Display results in a separate tab in SSMS

After enabling this option, the query results will be shown in a separate window. However, this option will be enabled when a new Query Window is opened. When we run the following query, the result set will be shown in the separate tab:

Executing a query in the Query Editor

After the mentioned setting is changed, the query result will be shown as follows:

Query Results in the Query Editor

The following illustration indicates the essential features of the SQL Editor toolbar:

SQL Editor menu details

  1. Available Databases: In this drop-down menu, we can determine a database on which the query will be executed
  2. Execute: This button starts the execution of a currently active query window
  3. Cancel Executing Query: This button stops the execution of the query
  4. Parse: This button validates the syntax of the query, but does not check the database objects
  5. Changing query result destination: In this button group, we can set the destination of the query result. It provides three different options:
    1. Results to Grid
    2. Results to Text
    3. Results to File
  6. Comment/Uncomment out the Selected Lines: These buttons provide the option for commenting or uncommenting on the selected code lines:

    Commenting queries on the Query editor window in SSMS

Tip: Some programmers wish to see the line numbers of the code in the query editor. Therefore, we need to follow the below steps:

  • Click the Options command, which is placed under the Tools menu
  • Navigate to the General tab, which is placed under Transact-SQL node
  • Check the Line numbers option

The Line numbers option in the Options window of SSMS

After this setting change, the queries will be formatted as follows:

Showing Line numbers in Query editor in SSMS


In this article, we learned the basics of Microsoft SQL Server Management Studio and the following articles will help to improve SSMS-related skills :

Esat Erkec
Latest posts by Esat Erkec (see all)