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…

  • Connecting to SQL Server on Another Domain

    This post contains a guide on how to connect to SQL Server with Windows Authentication, but using a different Domain User other than your own. The regular Windows SQL Server User connects & runs their queries via SQL Server Management Studio (SSMS). If you’re in a corporate environment,…

    Read More


  • How to Rename a Computer that Hosts SQL Server

    When changing the hostname of a computer that is running SQL Server, we have to update system metadata so that remote connections and applications do not lose connectivity. This guide provides a clear, step-by-step approach to updating SQL Server metadata after a hostname change. This is more often…

    Read More


  • Get Database Sizes in SQL Server

    Knowing how much disk space your databases are consuming in SQL Server is an important thing to know and monitor as a Database Administrator. As well as this, we should be looking at future growth of database files, ensuring we have enough disk space for years to come.…

    Read More


  • How to Backup a SQL Server Database

    This guide provides a simple demo on how to back up a SQL Server database and explains three main types of backups in MS SQL: > SQL Server Full Backup > SQL Server Transaction Log Backup > SQL Server Differential Backup > Additional Notes on SQL Server Backups…

    Read More


  • Get Estimated Database Backup/Restore Example

    When you’re waiting on a database backup or restore to complete in SQL Server, we can run the script below to get an estimated time of how long the backup has left to go – We have one 5GB database here currently being backed up at the time…

    Read More


  • Get Last Backup Times for all Databases in SQL Server

    Ensuring your databases are regularly backed up is critical for data recovery in case of corruption, accidental deletions, or other failures. If you don’t have a backup, recovering lost data may be impossible. As a Database Administrator, it’s your number one Priority along-side ensuring your SQL Service is…

    Read More


  • How to Check Table Sizes in SQL Server

    In this post, I’m sharing different ways of checking table sizes in SQL Server. There’s many ways to get this information, and whether you prefer using T-SQL scripts for automation, or SSMS tools for quick checks, these methods offer flexibility for different situations as a SQL Database Administrator.…

    Read More


  • Drop Table if Exists in SQL Server

    The DROP TABLE command in SQL Server removes a table from the database, as its name suggests. In this post, we’ll look at how to use the DROP TABLE IF EXISTS command, which makes dropping tables more efficient and error-free by adding a conditional check. Example: Drop Table…

    Read More


  • Get Last Database Restore Date and Time in SQL Server

    This guide provides a script to retrieve the last restore date and time for each database in SQL Server. It’s particularly helpful for tracking restore operations or verifying backups during disaster recovery scenarios. The script below queries the sys.databases and dbo.restorehistory system tables to get the most recent…

    Read More


  • List All SQL Agent Jobs in SQL Server

    This post provides a SQL script to list all SQL Server Agent Jobs on a Microsoft SQL Server instance. The sysjobs and sysjobsteps tables we are querying are in the M-S-D-B database. Fun fact, I am unable to publish a post with this actual database name without seeing…

    Read More