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…

  • Running Scheduled Tasks in SQL Server Express

    Running scheduled tasks in SQL Server Express requires an alternative approach since this edition lacks SQL Server Agent. Tasks like index maintenance, backups, or other recurring operations can be scheduled using Windows Task Scheduler. Below is a straightforward method to set up and execute such tasks using sqlcmd…

    Read More


  • sqlcmd Examples (SQL Server)

    The sqlcmd utility allows you to execute Transact-SQL commands directly from the command line using ODBC, enabling SQL Server batch execution without the need for a GUI. This post contains sqlcmd examples to help you understand it more. sqlcmd is essential for running SQL queries, automating tasks, and…

    Read More


  • How to Rename Schema’s in SQL Server

    Changing the schema of a table in SQL Server can be a rare task for database administrators but a more common requirement for database developers. This guide walks through how to move a table from one schema to another using the ALTER SCHEMA statement. During my time as…

    Read More


  • Adding & Removing SQL Features via Command

    This post will guide you on how to add and remove features from SQL Server via the command line. The process includes checking installed features, installing a new feature (such as replication), and uninstalling a feature when no longer needed. The following areas will be covered within this…

    Read More


  • Install/Uninstall SQL Server via Command

    This is a post on installing SQL Server via command; I have a Windows Server 2016 Core running on a local Hyper-V test environment, and I’m installing SQL Server 2019, then uninstalling it. There’s 4 parts to this one;# Download a SQL Server ISO. # Mount the ISO…

    Read More


  • Resolving “Windows could not start the SQL Server”

    If you encounter the message “Windows could not start the SQL Server on 127.0.0.1”, it signifies a problem preventing the SQL Server service from starting properly. This error is broad and can stem from various causes. Diagnosing the Issue To uncover the root cause, we can check Windows…

    Read More


  • Resolving “Index was out of range” in SSMS

    This post is here to help if you’ve encountered the following error while performing a task in SQL Server Management Studio (SSMS): Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index (mscorlib) In my experience, I’ve seen this…

    Read More


  • Creating a Linked Server for a PostgreSQL Database

    This is a post on how to create a Linked Server to a PostgreSQL database. In my previous post, I created a Linked Server to another SQL Server instance. This time, it’s a link to a Postgres database. I recommend checking out my other post for pre-requisite information…

    Read More


  • Creating a Linked Server to SQL Server

    Linked Servers in SQL Server allow you to query external databases, such as remote SQL Server instances, Oracle, ODBC or MS Access databases. It provides easy query access to another database server for users, however it’s not the most efficient ways to do it. The following steps should…

    Read More


  • Database Growth Events in SQL Server

    When a database file reaches its maximum allocated size, a growth event is triggered to expand the file and allow for more data storage. The size of these growth events can be configured in the database options or by using the ALTER DATABASE statement, as demonstrated below. Properly…

    Read More