Author: Peter Whyte

  • Granting the VIEW SERVER STATE Permission in SQL Server

    In SQL Server, the VIEW SERVER STATE permission allows a user to view server-wide dynamic management views (DMVs) and functions. This is often useful for troubleshooting, monitoring, and performance tuning. In this blog post, I’ll share how to check which users have the VIEW SERVER STATE permission, and…

    Read More


  • Why Is the Database in “In Recovery” Mode?

    In this post I’m hoping to help you resolve issues if your SQL Server Database is stuck “in Recovery” Mode. SQL Server enters recovery mode to ensure data integrity by:> Analyzing Transactions: Identifies changes since the last checkpoint.> Redoing Transactions: Reapplies committed changes not yet written to the…

    Read More


  • How to View the Definition of a Stored Procedure

    In this post, I’m sharing some SQL Scripts that will help you view the definition text of Stored Procedures and other objects in SQL Server. Ways to Query Stored Procedure Text Like a lot of tasks in MSSQL, there’s various ways we can get this information, including:> sys.sql_modules:…

    Read More


  • SQL Script to Show Exclusive Locks on Tables

    In this post I’m sharing a SQL script that will show exclusive locks for all tables in a database, with added info to help you understand what we’re looking at. Exclusive locks are a natural thing in SQL Server which ensures data integrity during updates or deletions by…

    Read More


  • How to Get SQL Server’s IP Address

    When managing or troubleshooting SQL Server, you might need to get the IP address your SQL Server instance is listening on. While servers can listen on multiple IP addresses, SQL Server offers a straightforward way to determine which address is used for your current connection. In this post…

    Read More


  • Identify Missing & Unused Indexes in SQL Server

    Indexes are crucial for SQL Server query performance. Everyone needs an Index. However, improper indexing strategies can degrade database performance, leading to slow queries and cause resource bottlenecks. Effectively managing indexes involves not only identifying the missing ones that could improve performance, but also pinpointing unused indexes that…

    Read More


  • SQL Server Performance Tuning: Index Fragmentation Scripts

    In this post I’m sharing more scripts to help with SQL Server performance tuning. This time, we’re looking at index and heap fragmentation which are useful for pinpointing inefficiencies on your database. Fragmentation, whether in indexes or heaps, can lead to slower queries, inefficient storage, and increased maintenance…

    Read More


  • Show User Activity and Blocking in SQL Server

    In this post I’m sharing a SQL script that will show currently running and blocking queries in SQL Server, with some other useful info along the way. This is script I run often as a DBA. It’s useful for identifying blocking or long running transactions, or checking in…

    Read More


  • Download and Install SQL Server Management Studio (SSMS)

    In this short post, I’ll share how to easily download and install SQL Server Management Studio (SSMS) on your Windows computer. I’ll include some tips to help improve your SSMS experience too! Step 1: Download SSMS Go to the official Microsoft website to download the latest version of…

    Read More


  • SQL to SQL: A Practical Guide from a DBA

    If you’re looking to connect, migrate, or convert between SQL databases, this post is aimed at you. Whether you’re working with SQL Server, MySQL, PostgreSQL, or others, I’m hoping to help explain some common tasks you might need to perform. Contents: > Connecting SQL Databases > Linked Servers:…

    Read More