T-SQL, yes please!

How to verify connection to database in Entity Framework Core?

This article explains how to perform a very simple and lightweight database connection test for an existing database context. A while ago, I needed to develop a simple API that I can poll from a load balancer to see whether: An Azure service hosting it is up and It has a connection to its SQL database This simple API would be used for monitoring purposes – simple stuff, sure, but what’s the best way to implement this without causing any unnecessary load to the database,…Continue reading How to verify connection to database in Entity Framework Core?

Microsoft SQL Server logo

How to clean up duplicates from MS SQL Database?

This article explains how to query and remove duplicate entries from a Microsoft SQL database using T-SQL. The same model works both for Azure Databases (in Azure SQL Query Editor) and databases on MS SQL Server (using SSMS – SQL Server Management Studio). Background Why bother? That’s a (somewhat) valid question. A table in a SQL database can have quite a few rows as long as you have plenty of storage space available. The number of rows might (technically speaking) be limited by the maximum…Continue reading How to clean up duplicates from MS SQL Database?

Microsoft SQL Server logo

Easily querying all the database and log file sizes on SQL Server

Quite often you get the need to simply quickly query all the database sizes on MS SQL Server – most typically, for us, this need arises when a development machine gets low on disk space, and we need to check if some database’s log size has been growing, or if something else is wrong. In my daily work, I rarely encounter this requirement anymore. Azure has almost entirely obliterated the need for such diagnostics, since it’s so easy to spin up or scale up new…Continue reading Easily querying all the database and log file sizes on SQL Server