Category: SQL Server

SQL Server Blog Archives, by Peter Whyte (Database Administrator).
Includes: Database Admin, Management Studio (SSMS), Windows Admin, PowerShell, WSL, MSSQL Backups, Restores & more…

  • Copying Dates into Excel

    There’s often a need to quickly copy/paste a database query output into an Excel sheet, rather than exporting as a .csv file. When you do this for a DATETIME column though, it’ll show up in Excel looking something like this. I don’t think Excel likes the milliseconds. This…

    Read More


  • Stack Exchange Data Explorer

    As a DBA, I’ve found Stack Exchange Data Explorer to be a really useful tool for exploring and analyzing the data from the Stack Exchange network of websites. It’s kind of like having a SQL playground where you can run all sorts of queries and see what insights…

    Read More


  • Monitoring Database Growth Events in SQL Server

    Database growth events occur when a SQL Server database file reaches its capacity and automatically grows to accommodate more data. These events are configured in the database properties, where you can define growth increments in MB or GB. Properly configuring these settings is important for maintaining performance, as…

    Read More


  • Show Line Numbers in SQL Server Management Studio (SSMS)

    This is a tip on how to show line numbers in the SQL Server Management Studio (SSMS) query window. This is useful when you receive an error message with reference to a line in your code, although it’s not a necessity to have it enabled as you’ll see…

    Read More


  • Show Available Disk Space in SQL Server

    This blog post is to share a script that you can run in SQL Server (versions 2008 R2 and above) which shows the available disk space for all local volumes on a SQL Server host. I’m also including a quick note on how to get this information with…

    Read More


  • Killing SQL Server Processes (SPIDs)

    Sometimes in SQL Server, you encounter processes that need to be terminated—whether it’s a query running wild, consuming too many resources, or holding up others. In this demo, we’ll set up a blocking SPID to simulate such a scenario, then resolve it by identifying and killing the offending…

    Read More


  • Renaming a computer that hosts SQL Server

    When changing the hostname of a computer running SQL Server, system metadata must be updated so that remote connections and applications do not lose connectivity. Those that use @@SERVERNAME or query sys.servers for the hostname that is. Microsoft’s documentation pages are a must read as always. Some considerations include;…

    Read More


  • Installing SQL Server 2017

    Installing SQL is a straight-forward task… but it’s important that things are in-place from the get-go to prevent having to make changes on a live system. There are a few best practises that can be defined within the installation wizard and many to be applied post install. This…

    Read More


  • Script To Get Estimated Database Backup or Restore Time

    This post contains a SQL script to get estimated completion times and process information for your currently running database backups & restores in SQL Server. Backing up a database can often take a very long time. It depends on various factors, one obvious reason being, that the bigger…

    Read More