SQL-Query Basics  «Prev  Next»
Lesson 2 Executing queries
Objective Describe how to execute your queries.

Executing SQL Server Queries

Most of the modules in this course are geared towards constructing different types of queries. Once you construct a query, you will need to know how to send it to SQL Server for processing, also known as executing[1] or issuing[2] a query. Although you can take a complicated approach to issuing a query, such as writing a VB.NET or Visual C++ program, the easiest way to execute a query is to use SSMS with SQL Server 2022. SQL Server Management Studio (SSMS) is a crucial tool for optimizing[3] queries in SQL Server 2022. It provides several features and functionalities that enable you to analyze query performance and identify areas for improvement.

Process for installing SSMS after SQL Server 2022 has been installed

Here’s a clear step-by-step process for installing SQL Server Management Studio (SSMS) after you've installed SQL Server 2022:
🔧 Step-by-Step Guide to Installing SSMS
  1. Go to the Official Download Page
    • Open a browser and navigate to: https://aka.ms/ssms
    • This link redirects to the official Microsoft page for downloading SSMS.
  2. Download the SSMS Installer
    • Click the “Download SQL Server Management Studio” button.
    • The installer file (e.g., SSMS-Setup-*.exe) will begin downloading.
  3. Run the Installer
    • Once downloaded, double-click the .exe file to launch the installation wizard.
    • If prompted by User Account Control, click Yes to allow the installer to make changes.
  4. Choose Installation Settings
    • The installer will display a welcome screen.
    • You can accept the default install location (recommended), or click Change to select a different folder.
  5. Begin Installation
    • Click the Install button to start the process.
    • The installation may take several minutes depending on system performance.
  6. Restart (if required)
    • Once the setup is complete, you may be prompted to restart your computer.
    • Click Close, and restart if necessary.
🎯 After Installation
  • Launch SSMS via:
    • Start Menu > Microsoft SQL Server Tools > SQL Server Management Studio, or
    • Search "SSMS" from the Start menu.
  • Connect to your local SQL Server 2022 instance using:
    • Server type: Database Engine
    • Server name: localhost or the named instance (e.g., .\SQLEXPRESS)
    • Authentication: Choose Windows Authentication or SQL Server Authentication as needed
📝 Notes
  • SSMS installs separately and can manage any supported SQL Server version, including older instances (2012+) and cloud instances like Azure SQL Database.
  • Always try to install the latest version of SSMS, as it includes important updates and compatibility fixes.
SSMS Enterprise deployments

SQL-Server Management Studio

The SQL Server Management Studio is pretty much home base when administering a SQL Server. It provides a variety of functionality for managing your server using a relatively easy-to-use graphical user interface. Branched off of the code base of Visual Studio IDE, it combines a myriad of functionality that used to be in separate tools. For the purposes of this course, I am not going to cover everything that the Management Studio has to offer, but here is a quick rundown of the things you can do:
  1. Create, edit, and delete databases and database objects
  2. Query your database using T-SQL
  3. Manage scheduled tasks, such as backups and the execution of SSIS package runs
  4. Display current activity, such as who is logged on, what objects are locked, and from whichclient they are running
  5. Manage security, including such items as roles, logins, and remote and linked servers
  6. Initiate and manage the Database Mail Service
  7. Create and manage full-text search catalogs
  8. Manage confi guration settings for the server
  9. Initiate an instance of the new PowerShell console
  10. Create and manage publishing and subscribing databases for replication
  11. Manage data processing in cubes or tabular databases for SQL Server Analysis Services (SSAS)
  12. Create queries against a multidimensional SSAS database in MDX, or against a tabular SSAS database in DAX

The SQL Server Database Engine can display how it navigates tables and uses indexes to access or process the data for a query or other DML statement, such as an update. This is a display of an execution plan. To analyze a slow-running query, it is useful to examine the query execution plan to determine what is causing the problem. For more information about how SQL Server creates and uses execution plans, see SQL Statement
  • Processing and Execution Plan Caching and Reuse.
    You can display execution plans by using the following methods:
    1. SQL Server Management Studio : Displays either an estimated graphical execution plan (statements do not execute) or an actual graphical execution plan (on executed statements), which you can save and view in Management Studio.
    2. Transact-SQL SET statement options: When you use the Transact-SQL SET statement options, you can produce estimated and actual execution plans in XML or text.
    3. SQL Server Profiler event classes: You can select SQL Server Profiler event classes to include in traces that produce estimated and actual execution plans in XML or text in the trace results.

[1]Executing: The process of sending a query to SQL Server for processing. This is synonymous with Issuing.
[2]Issuing: The process of sending a query to SQL Server for processing. This is synonymous with Executing.
[3]Optimized: The process of determining the fastest possible way to execute a query. Optimization can be simple or complex, depending on the complexity of the query or stored procedure being issued.

SEMrush Software 2 SEMrush Banner 2